Commit | Line | Data |
---|---|---|
a911c360 MS |
1 | /* |
2 | * Test GDB's ability to save and reload a corefile. | |
3 | */ | |
4 | ||
5 | #include <stdlib.h> | |
6 | ||
7 | int extern_array[4] = {1, 2, 3, 4}; | |
8 | static int static_array[4] = {5, 6, 7, 8}; | |
9 | static int un_initialized_array[4]; | |
10 | static char *heap_string; | |
11 | ||
12 | void | |
13 | terminal_func () | |
14 | { | |
15 | return; | |
16 | } | |
17 | ||
18 | void | |
19 | array_func () | |
20 | { | |
21 | int local_array[4]; | |
22 | int i; | |
23 | ||
24 | heap_string = (char *) malloc (80); | |
25 | strcpy (heap_string, "I'm a little teapot, short and stout..."); | |
26 | for (i = 0; i < 4; i++) | |
27 | { | |
28 | un_initialized_array[i] = extern_array[i] + 8; | |
29 | local_array[i] = extern_array[i] + 12; | |
30 | } | |
31 | terminal_func (); | |
32 | } | |
33 | ||
34 | #ifdef PROTOTYPES | |
35 | int factorial_func (int value) | |
36 | #else | |
37 | int factorial_func (value) | |
38 | int value; | |
39 | #endif | |
40 | { | |
41 | if (value > 1) { | |
42 | value *= factorial_func (value - 1); | |
43 | } | |
44 | array_func (); | |
45 | return (value); | |
46 | } | |
47 | ||
48 | main() | |
49 | { | |
50 | factorial_func (6); | |
51 | return 0; | |
52 | } |