Allow making GDB not automatically connect to the native target.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / coremaker2.c
1 /* Copyright 1992-2014 Free Software Foundation, Inc.
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
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
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.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17
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
39 char *buf1;
40 char *buf2;
41
42 int coremaker_data = 1; /* In Data section */
43 int coremaker_bss; /* In BSS section */
44
45 const int coremaker_ro = 201; /* In Read-Only Data section */
46
47 void
48 func2 (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
65 void
66 func1 (int x)
67 {
68 func2 (x * 2);
69 }
70
71 int main ()
72 {
73 func1 (10);
74 return 0;
75 }
This page took 0.031026 seconds and 4 git commands to generate.