* gdb.base/call-signal-resume.exp, gdb.base/unwindonsignal.exp: Skip
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / coremaker2.c
CommitLineData
4c38e0a4 1/* Copyright 1992, 1993, 1994, 1995, 1996, 1999, 2007, 2008, 2009, 2010
3426d5ec
MC
2 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
a9762ec7
JB
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
3426d5ec 10
a9762ec7
JB
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
3426d5ec
MC
15
16 You should have received a copy of the GNU General Public License
a9762ec7 17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
3426d5ec 18
c2d11a7d
JM
19/* Simple little program that just generates a core dump from inside some
20 nested function calls. Keep this as self contained as possible, I.E.
21 use no environment resources other than possibly abort(). */
22
23#ifndef __STDC__
24#define const /**/
25#endif
26
27#ifndef HAVE_ABORT
28#define HAVE_ABORT 1
29#endif
30
31#if HAVE_ABORT
32#define ABORT abort()
33#else
34#define ABORT {char *invalid = 0; *invalid = 0xFF;}
35#endif
36
37/* Don't make these automatic vars or we will have to walk back up the
38 stack to access them. */
39
40char *buf1;
41char *buf2;
42
43int coremaker_data = 1; /* In Data section */
44int coremaker_bss; /* In BSS section */
45
46const int coremaker_ro = 201; /* In Read-Only Data section */
47
48void
49func2 (int x)
50{
51 int coremaker_local[5];
52 int i;
53 static int y;
54
55 /* Make sure that coremaker_local doesn't get optimized away. */
56 for (i = 0; i < 5; i++)
57 coremaker_local[i] = i;
58 coremaker_bss = 0;
59 for (i = 0; i < 5; i++)
60 coremaker_bss += coremaker_local[i];
61 coremaker_data = coremaker_ro + 1;
62 y = 10 * x;
63 ABORT;
64}
65
66void
67func1 (int x)
68{
69 func2 (x * 2);
70}
71
72int main ()
73{
74 func1 (10);
75 return 0;
76}
This page took 0.950686 seconds and 4 git commands to generate.