]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/gcore.c
2004-08-05 Michael Chastain <mec.gnu@mindspring.com>
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / gcore.c
CommitLineData
a911c360
MS
1/*
2 * Test GDB's ability to save and reload a corefile.
3 */
4
5#include <stdlib.h>
6
7int extern_array[4] = {1, 2, 3, 4};
8static int static_array[4] = {5, 6, 7, 8};
9static int un_initialized_array[4];
10static char *heap_string;
11
12void
13terminal_func ()
14{
15 return;
16}
17
18void
19array_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
35int factorial_func (int value)
36#else
37int 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
48main()
49{
50 factorial_func (6);
51 return 0;
52}