Commit | Line | Data |
---|---|---|
dbbb1059 AB |
1 | /* This testcase is part of GDB, the GNU debugger. |
2 | ||
88b9d363 | 3 | Copyright 2018-2022 Free Software Foundation, Inc. |
dbbb1059 AB |
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 | /* This file is used for testing GDBs ability to pass structures to, and | |
19 | return structures from, functions. All of the structures in this test | |
36eb4c5f | 20 | are special in that they are small structures containing from 1 up to 5 |
dbbb1059 AB |
21 | scalar fields, the fields can be inside nested structures, and there can |
22 | be empty structures around too. | |
23 | ||
353229bf AH |
24 | When compiled for C++ this file also tests structures containing static |
25 | members (which live in global memory). In addition, empty structures in C++ | |
26 | have a size of 1 (compared to 0 in GNU C), which can effect structure | |
27 | padding. | |
28 | ||
36eb4c5f AH |
29 | This test is specifically written for RiscV and Aarch64, which both have |
30 | special ABI rules for structures like these, however, there should be no harm | |
31 | in running these tests on other targets, though in many cases the | |
dbbb1059 AB |
32 | structures will treated no differently to the structures already covered |
33 | in the structs.exp test script. */ | |
34 | ||
35 | #include <string.h> | |
7ea44a51 | 36 | #include "../lib/attributes.h" |
dbbb1059 AB |
37 | |
38 | /* Useful abreviations. */ | |
39 | typedef char tc; | |
40 | typedef short ts; | |
41 | typedef int ti; | |
42 | typedef long tl; | |
43 | typedef long long tll; | |
44 | typedef float tf; | |
45 | typedef double td; | |
46 | typedef long double tld; | |
47 | ||
48 | #ifdef TEST_COMPLEX | |
49 | typedef float _Complex tfc; | |
50 | typedef double _Complex tdc; | |
51 | typedef long double _Complex tldc; | |
52 | #endif /* TEST_COMPLEX */ | |
53 | ||
54 | #define MAKE_CHECK_FUNCS(TYPE) \ | |
7ea44a51 | 55 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE \ |
dbbb1059 AB |
56 | check_arg_ ## TYPE (struct TYPE arg) \ |
57 | { \ | |
58 | return cmp_ ## TYPE (arg, ref_val_ ## TYPE); \ | |
59 | } \ | |
60 | \ | |
7ea44a51 | 61 | struct TYPE __attribute__((noinline)) ATTRIBUTE_NOCLONE \ |
dbbb1059 AB |
62 | rtn_str_ ## TYPE (void) \ |
63 | { \ | |
64 | return (ref_val_ ## TYPE); \ | |
65 | } | |
66 | ||
67 | #define REF_VAL(NAME) struct NAME ref_val_ ## NAME | |
68 | #define ES(NAME) struct { } NAME | |
69 | ||
36eb4c5f | 70 | /* Test is either for a single type or two differing types. */ |
dbbb1059 | 71 | #if defined tA && ! defined tB |
36eb4c5f AH |
72 | #define tB tA |
73 | #endif | |
74 | #if ! defined tB | |
75 | #error "Incorrect configuration of tA and tB defines" | |
76 | #endif | |
dbbb1059 AB |
77 | |
78 | /* Structures with a single field nested to various depths, along with | |
79 | some empty structures. */ | |
36eb4c5f AH |
80 | struct struct_01_01 { ES(es1); struct { struct { tA a; } s1; } s2; }; |
81 | struct struct_01_02 { tA a; struct { struct { ES(es1); } s1; } s2; }; | |
82 | struct struct_01_03 { struct { struct { ES(es1); } s1; } s2; ES(es1); struct { struct { tA a; } s3; } s4;}; | |
83 | struct struct_01_04 { ES(es1); ES(es2); tA a; ES(es3); }; | |
84 | ||
85 | /* Structures with two fields nested to various depths, along with | |
86 | some empty structures. */ | |
87 | struct struct_02_01 { ES(es1); struct { struct { tA a; tB b; } s1; } s2; }; | |
88 | struct struct_02_02 { tA a; struct { struct { ES(es1); } s1; } s2; tB b; }; | |
89 | struct struct_02_03 { struct { struct { ES(es1); } s1; } s2; ES(es1); struct { struct { tA a; } s3; } s4; struct { struct { tB b; } s5; } s6;}; | |
90 | struct struct_02_04 { ES(es1); ES(es2); tA a; ES(es3); tB b; }; | |
91 | ||
92 | /* Structures with four fields nested to various depths, along with | |
93 | some empty structures. */ | |
94 | struct struct_04_01 { ES(es1); struct { struct { tA a; tB b; tA c; tB d; } s1; } s2; }; | |
95 | struct struct_04_02 { tA a; struct { struct { ES(es1); } s1; } s2; tB b; struct { struct { ES(es1); } s2; } s3; tA c; struct { struct { ES(es2); } s4; } s5; tB d;}; | |
96 | struct struct_04_03 { struct { struct { ES(es1); } s1; } s2; ES(es1); struct { struct { tA a; } s3; } s4; struct { struct { tB b; } s5; } s6; struct { struct { tA c; } s7; } s8; struct { struct { tB d; } s9; } s10;}; | |
97 | struct struct_04_04 { ES(es1); ES(es2); tA a; ES(es3); tB b; ES(es4); tA c; ES(es5); tB d; }; | |
98 | ||
99 | /* Structures with five fields nested to various depths, along with | |
100 | some empty structures. */ | |
101 | struct struct_05_01 { ES(es1); struct { struct { tA a; tB b; tA c; tB d; tA e; } s1; } s2; }; | |
102 | struct struct_05_02 { tA a; struct { struct { ES(es1); } s1; } s2; tB b; struct { struct { ES(es1); } s2; } s3; tA c; struct { struct { ES(es2); } s4; } s5; tB d; struct { struct { ES(es2); } s6; } s7; tB e;}; | |
103 | struct struct_05_03 { struct { struct { ES(es1); } s1; } s2; ES(es1); struct { struct { tA a; } s3; } s4; struct { struct { tB b; } s5; } s6; struct { struct { tA c; } s7; } s8; struct { struct { tB d; } s9; } s10; struct { struct { tA e; } s11; } s12;}; | |
104 | struct struct_05_04 { ES(es1); ES(es2); tA a; ES(es3); tB b; ES(es4); tA c; ES(es5); tB d; ES(es6); tA e; }; | |
dbbb1059 | 105 | |
353229bf AH |
106 | /* Only C++ allows structures to have static members. */ |
107 | #ifdef __cplusplus | |
108 | ||
109 | /* Structures with two fields nested to various depths, one of which is static. | |
110 | Some include empty structures. */ | |
111 | struct struct_static_02_01 { struct sa { struct sb { tA a; static tB b; } s1; } s2; }; | |
112 | struct struct_static_02_02 { static tA a; struct { struct { ES(es1); } s1; } s2; tB b; }; | |
113 | struct struct_static_02_03 { struct { struct { ES(es1); } s1; } s2; ES(es1); struct { struct { tA a; } s3; } s4; struct sa { struct sb { static tB b; } s5; } s6;}; | |
114 | struct struct_static_02_04 { static tA a; tB b; }; | |
115 | ||
116 | /* Structures with four fields nested to various depths, some of which are | |
117 | static. Some include empty structures. */ | |
118 | struct struct_static_04_01 { struct sa { struct sb { static tA a; tB b; tA c; tB d; } s1; } s2; }; | |
119 | struct struct_static_04_02 { tA a; struct { struct { ES(es1); } s1; } s2; tB b; struct { struct { ES(es1); } s2; } s3; static tA c; struct { struct { ES(es2); } s4; } s5; static tB d;}; | |
120 | struct struct_static_04_03 { struct sa { struct sb { static tA a; } s3; } s4; struct sc { struct sd { static tB b; } s5; } s6; struct se { struct sf { static tA c; } s7; } s8; struct sg { struct sh { static tB d; } s9; } s10;}; | |
121 | struct struct_static_04_04 { ES(es1); ES(es2); tA a; ES(es3); tB b; ES(es4); tA c; ES(es5); static tB d; }; | |
122 | ||
123 | /* Structures with six fields nested to various depths, some of which are | |
124 | static. Some include empty structures. */ | |
125 | struct struct_static_06_01 { struct sa { struct sb { tA a; static tB b; tA c; tB d; tA e; } s1; } s2; tB f; }; | |
126 | struct struct_static_06_02 { tA a; static tB b; static tA c; tB d; tB e; tA f;}; | |
127 | struct struct_static_06_03 { struct { struct { ES(es1); } s1; } s2; ES(es1); struct sa { struct sb { static tA a; } s3; } s4; struct sc { struct sd { tB b; } s5; } s6; struct se { struct sf { static tA c; } s7; } s8; struct sg { struct sh { static tB d; } s9; } s10; struct { struct { tA e; tB f; } s11; } s12;}; | |
128 | struct struct_static_06_04 { ES(es1); ES(es2); static tA a; ES(es3); static tB b; ES(es4); static tA c; ES(es5); static tB d; ES(es6); static tA e; ES(es7); tB f; }; | |
129 | ||
130 | #endif | |
131 | ||
7ea44a51 | 132 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
94cb3754 | 133 | cmp_struct_01_01 (struct struct_01_01 a, struct struct_01_01 b) |
dbbb1059 AB |
134 | { return a.s2.s1.a == b.s2.s1.a; } |
135 | ||
7ea44a51 | 136 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
94cb3754 | 137 | cmp_struct_01_02 (struct struct_01_02 a, struct struct_01_02 b) |
dbbb1059 AB |
138 | { return a.a == b.a; } |
139 | ||
7ea44a51 | 140 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
94cb3754 | 141 | cmp_struct_01_03 (struct struct_01_03 a, struct struct_01_03 b) |
dbbb1059 AB |
142 | { return a.s4.s3.a == b.s4.s3.a; } |
143 | ||
7ea44a51 | 144 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
94cb3754 | 145 | cmp_struct_01_04 (struct struct_01_04 a, struct struct_01_04 b) |
dbbb1059 AB |
146 | { return a.a == b.a; } |
147 | ||
7ea44a51 | 148 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
94cb3754 | 149 | cmp_struct_02_01 (struct struct_02_01 a, struct struct_02_01 b) |
6dfc0041 | 150 | { return a.s2.s1.a == b.s2.s1.a && a.s2.s1.b == b.s2.s1.b; } |
dbbb1059 | 151 | |
7ea44a51 | 152 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
94cb3754 | 153 | cmp_struct_02_02 (struct struct_02_02 a, struct struct_02_02 b) |
36eb4c5f | 154 | { return a.a == b.a && a.b == b.b; } |
dbbb1059 | 155 | |
7ea44a51 | 156 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
94cb3754 | 157 | cmp_struct_02_03 (struct struct_02_03 a, struct struct_02_03 b) |
36eb4c5f | 158 | { return a.s4.s3.a == b.s4.s3.a && a.s6.s5.b == b.s6.s5.b; } |
dbbb1059 | 159 | |
7ea44a51 | 160 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
94cb3754 | 161 | cmp_struct_02_04 (struct struct_02_04 a, struct struct_02_04 b) |
36eb4c5f | 162 | { return a.a == b.a && a.b == b.b; } |
dbbb1059 | 163 | |
7ea44a51 | 164 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
94cb3754 | 165 | cmp_struct_04_01 (struct struct_04_01 a, struct struct_04_01 b) |
6dfc0041 AA |
166 | { return a.s2.s1.a == b.s2.s1.a && a.s2.s1.b == b.s2.s1.b |
167 | && a.s2.s1.c == b.s2.s1.c && a.s2.s1.d == b.s2.s1.d; } | |
dbbb1059 | 168 | |
7ea44a51 | 169 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
94cb3754 | 170 | cmp_struct_04_02 (struct struct_04_02 a, struct struct_04_02 b) |
36eb4c5f | 171 | { return a.a == b.a && a.b == b.b && a.c == b.c && a.d == b.d; } |
dbbb1059 | 172 | |
7ea44a51 | 173 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
94cb3754 | 174 | cmp_struct_04_03 (struct struct_04_03 a, struct struct_04_03 b) |
36eb4c5f AH |
175 | { return a.s4.s3.a == b.s4.s3.a && a.s6.s5.b == b.s6.s5.b |
176 | && a.s8.s7.c == b.s8.s7.c && a.s10.s9.d == b.s10.s9.d; } | |
dbbb1059 | 177 | |
7ea44a51 | 178 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
94cb3754 | 179 | cmp_struct_04_04 (struct struct_04_04 a, struct struct_04_04 b) |
36eb4c5f | 180 | { return a.a == b.a && a.b == b.b && a.c == b.c && a.d == b.d; } |
dbbb1059 | 181 | |
7ea44a51 | 182 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
94cb3754 | 183 | cmp_struct_05_01 (struct struct_05_01 a, struct struct_05_01 b) |
6dfc0041 AA |
184 | { return a.s2.s1.a == b.s2.s1.a && a.s2.s1.b == b.s2.s1.b |
185 | && a.s2.s1.c == b.s2.s1.c && a.s2.s1.d == b.s2.s1.d | |
36eb4c5f | 186 | && a.s2.s1.e == b.s2.s1.e; } |
dbbb1059 | 187 | |
7ea44a51 | 188 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
94cb3754 | 189 | cmp_struct_05_02 (struct struct_05_02 a, struct struct_05_02 b) |
36eb4c5f | 190 | { return a.a == b.a && a.b == b.b && a.c == b.c && a.d == b.d && a.e == b.e; } |
dbbb1059 | 191 | |
7ea44a51 | 192 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
94cb3754 | 193 | cmp_struct_05_03 (struct struct_05_03 a, struct struct_05_03 b) |
36eb4c5f AH |
194 | { return a.s4.s3.a == b.s4.s3.a && a.s6.s5.b == b.s6.s5.b |
195 | && a.s8.s7.c == b.s8.s7.c && a.s10.s9.d == b.s10.s9.d | |
196 | && a.s12.s11.e == b.s12.s11.e; } | |
197 | ||
7ea44a51 | 198 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
94cb3754 | 199 | cmp_struct_05_04 (struct struct_05_04 a, struct struct_05_04 b) |
36eb4c5f AH |
200 | { return a.a == b.a && a.b == b.b && a.c == b.c && a.d == b.d && a.e == b.e; } |
201 | ||
353229bf AH |
202 | #ifdef __cplusplus |
203 | ||
7ea44a51 | 204 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
353229bf AH |
205 | cmp_struct_static_02_01 (struct struct_static_02_01 a, |
206 | struct struct_static_02_01 b) | |
6dfc0041 | 207 | { return a.s2.s1.a == b.s2.s1.a && a.s2.s1.b == b.s2.s1.b; } |
353229bf | 208 | |
7ea44a51 | 209 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
353229bf AH |
210 | cmp_struct_static_02_02 (struct struct_static_02_02 a, |
211 | struct struct_static_02_02 b) | |
212 | { return a.a == b.a && a.b == b.b; } | |
213 | ||
7ea44a51 | 214 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
353229bf AH |
215 | cmp_struct_static_02_03 (struct struct_static_02_03 a, |
216 | struct struct_static_02_03 b) | |
217 | { return a.s4.s3.a == b.s4.s3.a && a.s6.s5.b == b.s6.s5.b; } | |
218 | ||
7ea44a51 | 219 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
353229bf AH |
220 | cmp_struct_static_02_04 (struct struct_static_02_04 a, |
221 | struct struct_static_02_04 b) | |
222 | { return a.a == b.a && a.b == b.b; } | |
223 | ||
7ea44a51 | 224 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
353229bf AH |
225 | cmp_struct_static_04_01 (struct struct_static_04_01 a, |
226 | struct struct_static_04_01 b) | |
6dfc0041 AA |
227 | { return a.s2.s1.a == b.s2.s1.a && a.s2.s1.b == b.s2.s1.b |
228 | && a.s2.s1.c == b.s2.s1.c && a.s2.s1.d == b.s2.s1.d; } | |
353229bf | 229 | |
7ea44a51 | 230 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
353229bf AH |
231 | cmp_struct_static_04_02 (struct struct_static_04_02 a, |
232 | struct struct_static_04_02 b) | |
233 | { return a.a == b.a && a.b == b.b && a.c == b.c && a.d == b.d; } | |
234 | ||
7ea44a51 | 235 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
353229bf AH |
236 | cmp_struct_static_04_03 (struct struct_static_04_03 a, |
237 | struct struct_static_04_03 b) | |
238 | { return a.s4.s3.a == b.s4.s3.a && a.s6.s5.b == b.s6.s5.b | |
239 | && a.s8.s7.c == b.s8.s7.c && a.s10.s9.d == b.s10.s9.d; } | |
240 | ||
7ea44a51 | 241 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
353229bf AH |
242 | cmp_struct_static_04_04 (struct struct_static_04_04 a, |
243 | struct struct_static_04_04 b) | |
244 | { return a.a == b.a && a.b == b.b && a.c == b.c && a.d == b.d; } | |
245 | ||
7ea44a51 | 246 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
353229bf AH |
247 | cmp_struct_static_06_01 (struct struct_static_06_01 a, |
248 | struct struct_static_06_01 b) | |
6dfc0041 AA |
249 | { return a.s2.s1.a == b.s2.s1.a && a.s2.s1.b == b.s2.s1.b |
250 | && a.s2.s1.c == b.s2.s1.c && a.s2.s1.d == b.s2.s1.d | |
353229bf AH |
251 | && a.s2.s1.e == b.s2.s1.e && a.f == b.f; } |
252 | ||
7ea44a51 | 253 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
353229bf AH |
254 | cmp_struct_static_06_02 (struct struct_static_06_02 a, |
255 | struct struct_static_06_02 b) | |
256 | { return a.a == b.a && a.b == b.b && a.c == b.c && a.d == b.d && a.e == b.e | |
257 | && a.f == b.f; } | |
258 | ||
7ea44a51 | 259 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
353229bf AH |
260 | cmp_struct_static_06_03 (struct struct_static_06_03 a, |
261 | struct struct_static_06_03 b) | |
262 | { return a.s4.s3.a == b.s4.s3.a && a.s6.s5.b == b.s6.s5.b | |
263 | && a.s8.s7.c == b.s8.s7.c && a.s10.s9.d == b.s10.s9.d | |
264 | && a.s12.s11.e == b.s12.s11.e && a.s12.s11.f == b.s12.s11.f; } | |
265 | ||
7ea44a51 | 266 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
353229bf AH |
267 | cmp_struct_static_06_04 (struct struct_static_06_04 a, |
268 | struct struct_static_06_04 b) | |
269 | { return a.a == b.a && a.b == b.b && a.c == b.c && a.d == b.d && a.e == b.e | |
270 | && a.f == b.f; } | |
271 | ||
272 | #endif | |
273 | ||
36eb4c5f AH |
274 | REF_VAL(struct_01_01) = { {}, { { 'a' } } }; |
275 | REF_VAL(struct_01_02) = { 'a', { { {} } } }; | |
276 | REF_VAL(struct_01_03) = { { { {} } }, {}, { { 'a' } } }; | |
277 | REF_VAL(struct_01_04) = { {}, {}, 'a', {} }; | |
278 | ||
279 | REF_VAL(struct_02_01) = { {}, { { 'a', 'b' } } }; | |
280 | REF_VAL(struct_02_02) = { 'a', { { {} } }, 'b' }; | |
281 | REF_VAL(struct_02_03) = { { { {} } }, {}, { { 'a' } }, { { 'b' } } }; | |
282 | REF_VAL(struct_02_04) = { {}, {}, 'a', {}, 'b' }; | |
283 | ||
284 | REF_VAL(struct_04_01) = { {}, { { 'a', 'b', 'c', 'd' } } }; | |
285 | REF_VAL(struct_04_02) = { 'a', { { {} } }, 'b', { { {} } }, 'c', { { {} } }, 'd' }; | |
286 | REF_VAL(struct_04_03) = { { { {} } }, {}, { { 'a' } }, { { 'b' } }, { { 'c' } }, { { 'd' } } }; | |
287 | REF_VAL(struct_04_04) = { {}, {}, 'a', {}, 'b', {}, 'c', {}, 'd' }; | |
288 | ||
289 | REF_VAL(struct_05_01) = { {}, { { 'a', 'b', 'c', 'd', 'e' } } }; | |
290 | REF_VAL(struct_05_02) = { 'a', { { {} } }, 'b', { { {} } }, 'c', { { {} } }, 'd', { { {} } }, 'e' }; | |
291 | REF_VAL(struct_05_03) = { { { {} } }, {}, { { 'a' } }, { { 'b' } }, { { 'c' } }, { { 'd' } }, { { 'e' } } }; | |
292 | REF_VAL(struct_05_04) = { {}, {}, 'a', {}, 'b', {}, 'c', {}, 'd', {}, 'e' }; | |
dbbb1059 | 293 | |
353229bf AH |
294 | #ifdef __cplusplus |
295 | ||
296 | /* Initialise static members. */ | |
297 | tB struct_static_02_01::sa::sb::b = '1'; | |
298 | tA struct_static_02_02::a = '2'; | |
299 | tB struct_static_02_03::sa::sb::b = '3'; | |
300 | tA struct_static_02_04::a = '4'; | |
301 | tA struct_static_04_01::sa::sb::a = '5'; | |
302 | tA struct_static_04_02::c = '6'; | |
303 | tB struct_static_04_02::d = '7'; | |
304 | tA struct_static_04_03::sa::sb::a = '8'; | |
305 | tB struct_static_04_03::sc::sd::b = '9'; | |
306 | tA struct_static_04_03::se::sf::c = '0'; | |
307 | tB struct_static_04_03::sg::sh::d = 'A'; | |
308 | tB struct_static_04_04::d = 'B'; | |
309 | tB struct_static_06_01::sa::sb::b = 'C'; | |
310 | tB struct_static_06_02::b = 'D'; | |
311 | tA struct_static_06_02::c = 'E'; | |
312 | tA struct_static_06_03::sa::sb::a = 'F'; | |
313 | tA struct_static_06_03::se::sf::c = 'G'; | |
314 | tB struct_static_06_03::sg::sh::d = 'H'; | |
315 | tA struct_static_06_04::a = 'I'; | |
316 | tB struct_static_06_04::b = 'J'; | |
317 | tA struct_static_06_04::c = 'K'; | |
318 | tB struct_static_06_04::d = 'L'; | |
319 | tA struct_static_06_04::e = 'M'; | |
320 | ||
321 | REF_VAL(struct_static_02_01) = { { { 'a' } } }; | |
322 | REF_VAL(struct_static_02_02) = { { { {} } }, 'b' }; | |
323 | REF_VAL(struct_static_02_03) = { { { {} } }, {}, { { 'a' } }, { { } } }; | |
324 | REF_VAL(struct_static_02_04) = { 'b' }; | |
325 | REF_VAL(struct_static_04_01) = { { { 'b', 'c', 'd' } } }; | |
326 | REF_VAL(struct_static_04_02) = { 'a', { { {} } }, 'b', { { {} } }, { { {} } } }; | |
327 | REF_VAL(struct_static_04_03) = {}; | |
328 | REF_VAL(struct_static_04_04) = { {}, {}, 'a', {}, 'b', {}, 'c', {} }; | |
329 | REF_VAL(struct_static_06_01) = { { { 'a', 'c', 'd', 'e' } }, 'f' }; | |
330 | REF_VAL(struct_static_06_02) = { 'a', 'd', 'e', 'f' }; | |
331 | REF_VAL(struct_static_06_03) = { { { {} } }, {}, {}, { { 'b' } }, {}, /*{ { 'e', 'f' } }*/ }; | |
332 | REF_VAL(struct_static_06_04) = { {}, {}, {}, {}, {}, {}, {}, 'f' }; | |
333 | ||
334 | #endif | |
335 | ||
dbbb1059 | 336 | /* Create all of the functions GDB will call to check functionality. */ |
36eb4c5f AH |
337 | MAKE_CHECK_FUNCS(struct_01_01) |
338 | MAKE_CHECK_FUNCS(struct_01_02) | |
339 | MAKE_CHECK_FUNCS(struct_01_03) | |
340 | MAKE_CHECK_FUNCS(struct_01_04) | |
341 | MAKE_CHECK_FUNCS(struct_02_01) | |
342 | MAKE_CHECK_FUNCS(struct_02_02) | |
343 | MAKE_CHECK_FUNCS(struct_02_03) | |
344 | MAKE_CHECK_FUNCS(struct_02_04) | |
345 | MAKE_CHECK_FUNCS(struct_04_01) | |
346 | MAKE_CHECK_FUNCS(struct_04_02) | |
347 | MAKE_CHECK_FUNCS(struct_04_03) | |
348 | MAKE_CHECK_FUNCS(struct_04_04) | |
349 | MAKE_CHECK_FUNCS(struct_05_01) | |
350 | MAKE_CHECK_FUNCS(struct_05_02) | |
351 | MAKE_CHECK_FUNCS(struct_05_03) | |
352 | MAKE_CHECK_FUNCS(struct_05_04) | |
353229bf AH |
353 | #ifdef __cplusplus |
354 | MAKE_CHECK_FUNCS(struct_static_02_01) | |
355 | MAKE_CHECK_FUNCS(struct_static_02_02) | |
356 | MAKE_CHECK_FUNCS(struct_static_02_03) | |
357 | MAKE_CHECK_FUNCS(struct_static_02_04) | |
358 | MAKE_CHECK_FUNCS(struct_static_04_01) | |
359 | MAKE_CHECK_FUNCS(struct_static_04_02) | |
360 | MAKE_CHECK_FUNCS(struct_static_04_03) | |
361 | MAKE_CHECK_FUNCS(struct_static_04_04) | |
362 | MAKE_CHECK_FUNCS(struct_static_06_01) | |
363 | MAKE_CHECK_FUNCS(struct_static_06_02) | |
364 | MAKE_CHECK_FUNCS(struct_static_06_03) | |
365 | MAKE_CHECK_FUNCS(struct_static_06_04) | |
366 | #endif | |
dbbb1059 AB |
367 | |
368 | #define CALL_LINE(NAME) val += check_arg_ ## NAME (rtn_str_ ## NAME ()) | |
369 | ||
7ea44a51 | 370 | int __attribute__((noinline)) ATTRIBUTE_NOCLONE |
dbbb1059 AB |
371 | call_all () |
372 | { | |
94cb3754 | 373 | int val = 0; |
dbbb1059 | 374 | |
36eb4c5f AH |
375 | CALL_LINE(struct_01_01); |
376 | CALL_LINE(struct_01_02); | |
377 | CALL_LINE(struct_01_03); | |
378 | CALL_LINE(struct_01_04); | |
379 | CALL_LINE(struct_02_01); | |
380 | CALL_LINE(struct_02_02); | |
381 | CALL_LINE(struct_02_03); | |
382 | CALL_LINE(struct_02_04); | |
383 | CALL_LINE(struct_04_01); | |
384 | CALL_LINE(struct_04_02); | |
385 | CALL_LINE(struct_04_03); | |
386 | CALL_LINE(struct_04_04); | |
387 | CALL_LINE(struct_05_01); | |
388 | CALL_LINE(struct_05_02); | |
389 | CALL_LINE(struct_05_03); | |
390 | CALL_LINE(struct_05_04); | |
353229bf AH |
391 | #ifdef __cplusplus |
392 | CALL_LINE(struct_static_02_01); | |
393 | CALL_LINE(struct_static_02_02); | |
394 | CALL_LINE(struct_static_02_03); | |
395 | CALL_LINE(struct_static_02_04); | |
396 | CALL_LINE(struct_static_04_01); | |
397 | CALL_LINE(struct_static_04_02); | |
398 | CALL_LINE(struct_static_04_03); | |
399 | CALL_LINE(struct_static_04_04); | |
400 | CALL_LINE(struct_static_06_01); | |
401 | CALL_LINE(struct_static_06_02); | |
402 | CALL_LINE(struct_static_06_03); | |
403 | CALL_LINE(struct_static_06_04); | |
404 | #endif | |
dbbb1059 | 405 | |
94cb3754 | 406 | return val; |
dbbb1059 AB |
407 | } |
408 | ||
94cb3754 TV |
409 | int volatile v = 1; |
410 | ||
7ea44a51 | 411 | void __attribute__((noinline)) ATTRIBUTE_NOCLONE |
dbbb1059 AB |
412 | breakpt (void) |
413 | { | |
94cb3754 | 414 | v++; |
dbbb1059 AB |
415 | } |
416 | ||
417 | int | |
418 | main () | |
419 | { | |
420 | int res; | |
421 | ||
422 | res = call_all (); | |
423 | breakpt (); /* Break Here. */ | |
424 | return res; | |
425 | } |