1 /* Copyright 1992-1996, 1999, 2004, 2007-2012 Free Software Foundation,
4 This file is part of GDB.
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 3 of the License, or
9 (at your option) any later version.
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.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
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(). */
35 #define ABORT {char *invalid = 0; *invalid = 0xFF;}
39 # include <sys/resource.h>
40 # ifndef RLIM_INFINITY
41 # define RLIM_INFINITY -1
43 #endif /* USE_RLIMIT */
45 /* Don't make these automatic vars or we will have to walk back up the
46 stack to access them. */
51 int coremaker_data
= 1; /* In Data section */
52 int coremaker_bss
; /* In BSS section */
54 const int coremaker_ro
= 201; /* In Read-Only Data section */
59 int coremaker_local
[5];
65 struct rlimit rlim
= { RLIM_INFINITY
, RLIM_INFINITY
};
67 setrlimit (RLIMIT_CORE
, &rlim
);
71 /* Make sure that coremaker_local doesn't get optimized away. */
72 for (i
= 0; i
< 5; i
++)
73 coremaker_local
[i
] = i
;
75 for (i
= 0; i
< 5; i
++)
76 coremaker_bss
+= coremaker_local
[i
];
77 coremaker_data
= coremaker_ro
+ 1;
This page took 0.031879 seconds and 5 git commands to generate.