Commit | Line | Data |
---|---|---|
1e611234 PM |
1 | /* This testcase is part of GDB, the GNU debugger. |
2 | ||
618f726f | 3 | Copyright 2013-2016 Free Software Foundation, Inc. |
1e611234 PM |
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 | { | |
38 | int d = 15; | |
39 | int e = 14; | |
40 | const char *foo = "Inside block"; | |
41 | { | |
42 | int f = 42; | |
43 | int g = 19; | |
44 | const char *bar = "Inside block x2"; | |
45 | { | |
46 | short h = 9; | |
47 | h = h +1; /* Inner test breakpoint */ | |
48 | } | |
49 | } | |
50 | } | |
51 | ||
52 | return; /* Backtrace end breakpoint */ | |
53 | } | |
54 | ||
55 | void funcb(int j) | |
56 | { | |
57 | struct foo | |
58 | { | |
59 | int a; | |
60 | int b; | |
61 | }; | |
62 | ||
63 | struct foo bar; | |
64 | ||
65 | bar.a = 42; | |
66 | bar.b = 84; | |
67 | ||
68 | funca(); | |
69 | return; | |
70 | } | |
71 | ||
72 | void funca(void) | |
73 | { | |
74 | foobar fb; | |
75 | foobar *bf = NULL; | |
76 | ||
77 | if (count < 10) | |
78 | { | |
79 | count++; | |
80 | funcb(count); | |
81 | } | |
82 | ||
83 | fb.nothing = "Foo Bar"; | |
84 | fb.f = 42; | |
85 | fb.s = 19; | |
86 | ||
87 | bf = alloca (sizeof (foobar)); | |
88 | bf->nothing = alloca (128); | |
89 | bf->nothing = "Bar Foo"; | |
90 | bf->f = 24; | |
91 | bf->s = 91; | |
92 | ||
93 | end_func(21, "Param", bf, fb); | |
94 | return; | |
95 | } | |
96 | ||
97 | ||
98 | void func1(void) | |
99 | { | |
100 | funca(); | |
101 | return; | |
102 | } | |
103 | ||
104 | int func2(int f) | |
105 | { | |
106 | int c; | |
107 | const char *elided = "Elided frame"; | |
108 | foobar fb; | |
109 | foobar *bf = NULL; | |
110 | ||
111 | fb.nothing = "Elided Foo Bar"; | |
112 | fb.f = 84; | |
113 | fb.s = 38; | |
114 | ||
115 | bf = alloca (sizeof (foobar)); | |
116 | bf->nothing = alloca (128); | |
117 | bf->nothing = "Elided Bar Foo"; | |
118 | bf->f = 48; | |
119 | bf->s = 182; | |
120 | ||
121 | func1(); | |
122 | return 1; | |
123 | } | |
124 | ||
125 | void func3(int i) | |
126 | { | |
127 | func2(i); | |
128 | ||
129 | return; | |
130 | } | |
131 | ||
132 | int func4(int j) | |
133 | { | |
134 | func3(j); | |
135 | ||
136 | return 2; | |
137 | } | |
138 | ||
139 | int func5(int f, int d) | |
140 | { | |
141 | int i = 0; | |
142 | char *random = "random"; | |
143 | i=i+f; | |
144 | ||
145 | func4(i); | |
146 | return i; | |
147 | } | |
148 | ||
a267f3ad | 149 | int |
1e611234 PM |
150 | main() |
151 | { | |
152 | int z = 32; | |
153 | int y = 44; | |
154 | const char *foo1 = "Test"; | |
155 | func5(3,5); | |
a267f3ad | 156 | return 0; |
1e611234 | 157 | } |