Imported Upstream version 7.9
[platform/upstream/gdb.git] / gdb / testsuite / gdb.perf / backtrace.c
1 /* This testcase is part of GDB, the GNU debugger.
2
3    Copyright (C) 2013-2015 Free Software Foundation, Inc.
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 struct s
19 {
20   int a[256];
21   char c[256];
22 };
23
24 static void
25 fun2 (void)
26 {
27
28 }
29
30 static void
31 fun1 (int i, int j, long k, struct s ss)
32 {
33   /* Allocate local variables on stack.  */
34   struct s s1;
35
36   if (i < BACKTRACE_DEPTH)
37     fun1 (i + 1, j + 2, k - 1, ss);
38   else
39     {
40       int ii;
41
42       for (ii = 0; ii < 10; ii++)
43         fun2 ();
44     }
45 }
46
47 int
48 main (void)
49 {
50   struct s ss;
51
52   fun1 (0, 0, 200, ss);
53   return 0;
54 }