f5a3d6720a92683d26a88bda838565a77280d3a5
[external/binutils.git] / gdb / testsuite / gdb.python / py-framefilter-mi.c
1 /* This testcase is part of GDB, the GNU debugger.
2
3    Copyright 2013-2016 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 #include <stdlib.h>
19
20 void funca(void);
21 int count = 0;
22
23 typedef struct
24 {
25   char *nothing;
26   int f;
27   short s;
28 } foobar;
29
30 void end_func (int foo, char *bar, foobar *fb, foobar bf)
31 {
32   const char *str = "The End";
33   const char *st2 = "Is Near";
34   int b = 12;
35   short c = 5;
36   {
37     int d = 15;
38     int e = 14;
39     const char *foo = "Inside block";
40     {
41       int f = 42;
42       int g = 19;
43       const char *bar = "Inside block x2";
44       {
45         short h = 9;
46         h = h +1;  /* Inner test breakpoint  */
47       }
48     }
49   }
50
51   return; /* Backtrace end breakpoint */
52 }
53
54 void funcb(int j)
55 {
56   struct foo
57   {
58     int a;
59     int b;
60   };
61
62   struct foo bar;
63
64   bar.a = 42;
65   bar.b = 84;
66
67   funca();
68   return;
69 }
70
71 void funca(void)
72 {
73   foobar fb;
74   foobar *bf;
75
76   if (count < 10)
77     {
78       count++;
79       funcb(count);
80     }
81
82   fb.nothing = "Foo Bar";
83   fb.f = 42;
84   fb.s = 19;
85
86   bf = malloc (sizeof (foobar));
87   bf->nothing = malloc (128);
88   bf->nothing = "Bar Foo";
89   bf->f = 24;
90   bf->s = 91;
91
92   end_func(21, "Param", bf, fb);
93   free (bf->nothing);
94   free (bf);
95   return;
96 }
97
98
99 void func1(void)
100 {
101   funca();
102   return;
103 }
104
105 int func2(void)
106 {
107   func1();
108   return 1;
109 }
110
111 void func3(int i)
112 {
113   func2();
114
115   return;
116 }
117
118 int func4(int j)
119 {
120   func3(j);
121
122   return 2;
123 }
124
125 int func5(int f, int d)
126 {
127   int i = 0;
128   char *random = "random";
129   i=i+f;
130
131   func4(i);
132   return i;
133 }
134
135 int
136 main()
137 {
138   func5(3,5);
139   return 0;
140 }