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