xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.python/pretty-print-call-by-hand.c (revision f8cf1a9151c7af1cb0bd8b09c13c66bca599c027)
1 /* This testcase is part of GDB, the GNU debugger.
2 
3    Copyright 2022-2023 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 mytype
19 {
20   char *x;
21 };
22 
23 void
24 rec (int i)
25 {
26   if (i <= 0)
27     return;
28   rec (i-1);
29 }
30 
31 int
32 f ()
33 {
34   rec (100);
35   return 2;
36 }
37 
38 void
39 g (struct mytype mt, int depth)
40 {
41   if (depth <= 0)
42     return; /* TAG: final frame */
43   g (mt, depth - 1); /* TAG: first frame */
44 }
45 
46 int
47 main ()
48 {
49   struct mytype mt;
50   mt.x = "hello world";
51   g (mt, 10); /* TAG: outside the frame */
52   return 0;
53 }
54