xref: /openbsd-src/gnu/usr.bin/binutils/gdb/testsuite/gdb.base/gdb1250.c (revision b725ae7711052a2233e31a66fefb8a752c388d7a)
1*b725ae77Skettenis /* Test program for stack trace through noreturn function.
2*b725ae77Skettenis 
3*b725ae77Skettenis    Copyright 2003 Free Software Foundation, Inc.
4*b725ae77Skettenis 
5*b725ae77Skettenis    This file is part of the gdb testsuite.
6*b725ae77Skettenis 
7*b725ae77Skettenis    This program is free software; you can redistribute it and/or modify
8*b725ae77Skettenis    it under the terms of the GNU General Public License as published by
9*b725ae77Skettenis    the Free Software Foundation; either version 2 of the License, or
10*b725ae77Skettenis    (at your option) any later version.
11*b725ae77Skettenis 
12*b725ae77Skettenis    This program is distributed in the hope that it will be useful,
13*b725ae77Skettenis    but WITHOUT ANY WARRANTY; without even the implied warranty of
14*b725ae77Skettenis    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*b725ae77Skettenis    GNU General Public License for more details.
16*b725ae77Skettenis 
17*b725ae77Skettenis    You should have received a copy of the GNU General Public License
18*b725ae77Skettenis    along with this program; if not, write to the Free Software
19*b725ae77Skettenis    Foundation, Inc., 59 Temple Place - Suite 330,
20*b725ae77Skettenis    Boston, MA 02111-1307, USA.
21*b725ae77Skettenis 
22*b725ae77Skettenis    This file was written by Michael Elizabeth Chastain (mec@shout.net).  */
23*b725ae77Skettenis 
24*b725ae77Skettenis #include <stdlib.h>
25*b725ae77Skettenis 
26*b725ae77Skettenis int global = 0;
27*b725ae77Skettenis 
28*b725ae77Skettenis /* Foo, gcc thinks 'gamma' is a reserved identifier.
29*b725ae77Skettenis    http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12213
30*b725ae77Skettenis    I am not interested in testing that point so just avoid the word.
31*b725ae77Skettenis    -- chastain 2003-09-08. */
my_gamma(int * parray)32*b725ae77Skettenis void my_gamma (int *parray)
33*b725ae77Skettenis {
34*b725ae77Skettenis   return;
35*b725ae77Skettenis }
36*b725ae77Skettenis 
beta()37*b725ae77Skettenis void beta ()
38*b725ae77Skettenis {
39*b725ae77Skettenis   int array [4];
40*b725ae77Skettenis   array [0] = global++;
41*b725ae77Skettenis   array [1] = global++;
42*b725ae77Skettenis   array [2] = global++;
43*b725ae77Skettenis   array [3] = global++;
44*b725ae77Skettenis   my_gamma (array);
45*b725ae77Skettenis   abort ();
46*b725ae77Skettenis }
47*b725ae77Skettenis 
alpha()48*b725ae77Skettenis int alpha ()
49*b725ae77Skettenis {
50*b725ae77Skettenis   global++;
51*b725ae77Skettenis   beta ();
52*b725ae77Skettenis   return 0;
53*b725ae77Skettenis }
54*b725ae77Skettenis 
main()55*b725ae77Skettenis int main ()
56*b725ae77Skettenis {
57*b725ae77Skettenis   int i;
58*b725ae77Skettenis   global++;
59*b725ae77Skettenis   i = alpha ();
60*b725ae77Skettenis   return i;
61*b725ae77Skettenis }
62