-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblowstack.c
More file actions
37 lines (31 loc) · 813 Bytes
/
blowstack.c
File metadata and controls
37 lines (31 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdio.h>
#include <stdlib.h>
#include <comp421/yalnix.h>
#include <comp421/hardware.h>
void
foo(int depth)
{
char array[65532];
int i;
TracePrintf(0, "blowstack foo: depth %d\n", depth);
fprintf(stderr,"%d ",depth);
fflush(stderr);
TracePrintf(0, "%d ========================\n", depth);
for (i = 0; i < (int)sizeof(array); i++) {
array[i] = 'a';
// TracePrintf(0, "%i/%i %c \n", i, (int)sizeof(array), array[i]);
}
TracePrintf(0, "%d ======================== done!\n", depth);
if (depth == 1) return;
foo(depth-1);
}
int
main(int argc, char **argv)
{
(void)argc;
int num = atoi(argv[1]);
TracePrintf(0, "blowstack initially calling foo depth %d\n", num);
foo(num);
TracePrintf(0, "About to exit!\n");
Exit(0);
}