]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/auxv.c
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / auxv.c
CommitLineData
6aba47ca 1/* Copyright 1992, 1993, 1994, 1995, 1996, 1999, 2004, 2007
0a8490ad
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
8 the Free Software Foundation; either version 2 of the License, or (at
9 your option) any later version.
10
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
d65308ae
RM
21/* Simple little program that just generates a core dump from inside some
22 nested function calls. Keep this as self contained as possible, I.E.
23 use no environment resources other than possibly abort(). */
24
25#ifndef __STDC__
26#define const /**/
27#endif
28
29#ifndef HAVE_ABORT
30#define HAVE_ABORT 1
31#endif
32
33#if HAVE_ABORT
c9133d23 34#include <stdlib.h>
d65308ae
RM
35#define ABORT abort()
36#else
37#define ABORT {char *invalid = 0; *invalid = 0xFF;}
38#endif
39
40/* Don't make these automatic vars or we will have to walk back up the
41 stack to access them. */
42
43char *buf1;
44char *buf2;
45
46int coremaker_data = 1; /* In Data section */
47int coremaker_bss; /* In BSS section */
48
49const int coremaker_ro = 201; /* In Read-Only Data section */
50
51void
52func2 (int x)
53{
54 int coremaker_local[5];
55 int i;
56 static int y;
57
58 /* Make sure that coremaker_local doesn't get optimized away. */
59 for (i = 0; i < 5; i++)
60 coremaker_local[i] = i;
61 coremaker_bss = 0;
62 for (i = 0; i < 5; i++)
63 coremaker_bss += coremaker_local[i];
64 coremaker_data = coremaker_ro + 1;
65 y = 10 * x;
66 ABORT;
67}
68
69void
70func1 (int x)
71{
72 func2 (x * 2);
73}
74
75int main ()
76{
77 func1 (10);
78 return 0;
79}