import gdb-1999-12-06 snapshot
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / coremaker2.c
CommitLineData
c2d11a7d
JM
1/* Simple little program that just generates a core dump from inside some
2 nested function calls. Keep this as self contained as possible, I.E.
3 use no environment resources other than possibly abort(). */
4
5#ifndef __STDC__
6#define const /**/
7#endif
8
9#ifndef HAVE_ABORT
10#define HAVE_ABORT 1
11#endif
12
13#if HAVE_ABORT
14#define ABORT abort()
15#else
16#define ABORT {char *invalid = 0; *invalid = 0xFF;}
17#endif
18
19/* Don't make these automatic vars or we will have to walk back up the
20 stack to access them. */
21
22char *buf1;
23char *buf2;
24
25int coremaker_data = 1; /* In Data section */
26int coremaker_bss; /* In BSS section */
27
28const int coremaker_ro = 201; /* In Read-Only Data section */
29
30void
31func2 (int x)
32{
33 int coremaker_local[5];
34 int i;
35 static int y;
36
37 /* Make sure that coremaker_local doesn't get optimized away. */
38 for (i = 0; i < 5; i++)
39 coremaker_local[i] = i;
40 coremaker_bss = 0;
41 for (i = 0; i < 5; i++)
42 coremaker_bss += coremaker_local[i];
43 coremaker_data = coremaker_ro + 1;
44 y = 10 * x;
45 ABORT;
46}
47
48void
49func1 (int x)
50{
51 func2 (x * 2);
52}
53
54int main ()
55{
56 func1 (10);
57 return 0;
58}
This page took 0.024808 seconds and 4 git commands to generate.