1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2012-2015 Free Software Foundation, Inc.
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.
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.
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/>. */
18 /* This test triggers a crash when a physname for a subprogram has
19 a method pointer to an anonymous struct as a parameter. This
20 situation is possible with templates and lambda expressions,
21 reproduced here by the following source code:
26 int doit (void) { return 0; }
32 crash (int (a::*mp) (void)) {}
35 In order to avoid lambdas, the resulting output has been edited to
36 remove the DW_AT_name attribute from the DIEs describing "class a." */
38 #define OFFSET(LBL) .Ldie_ ## LBL - .Lcu1_begin
42 .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit Info */
44 .2byte 0x3 /* DWARF version number */
45 .4byte .Labbrev1_begin /* Offset Into Abbrev. Section */
46 .byte 0x4 /* Pointer Size (in bytes) */
49 .uleb128 0x1 /* (DIE (0xb) DW_TAG_compile_unit) */
50 .ascii "GNU C++ 4.6.3\0" /* DW_AT_producer */
51 .byte 0x4 /* DW_AT_language */
52 .ascii "anon-member-ptr.cc\0" /* DW_AT_name */
53 .4byte .Ldebug_line0 /* DW_AT_stmt_list */
56 .uleb128 0x2 /* (DIE (0x31) DW_TAG_class_type */
58 /* This is the "fudging" part... */
59 .ascii "a\0" /* DW_AT_name */
61 .byte 0x1 /* DW_AT_byte_size */
64 .uleb128 0x4 /* (DIE (0x59) DW_TAG_base_type */
65 .byte 0x4 /* DW_AT_byte_size */
66 .byte 0x5 /* DW_AT_encoding */
67 .ascii "int\0" /* DW_AT_name */
70 .uleb128 0x5 /* (DIE (0x60) DW_TAG_pointer_type) */
71 .byte 0x4 /* DW_AT_byte_size */
72 .4byte OFFSET (31) /* DW_AT_type */
75 .uleb128 0x6 /* (DIE (0x66) DW_TAG_class_type) */
76 .ascii "crash\0" /* DW_AT_name */
77 .byte 0x1 /* DW_AT_byte_size */
78 .4byte OFFSET (8d) /* DW_AT_sibling */
81 .uleb128 0x7 /* (DIE (0x72) DW_TAG_subprogram) */
82 .byte 0x1 /* DW_AT_external */
83 .ascii "crash\0" /* DW_AT_name */
84 .byte 0x1 /* DW_AT_accessibility */
85 .byte 0x1 /* DW_AT_declaration */
86 .4byte OFFSET (80) /* DW_AT_object_pointer */
89 .uleb128 0x3 /* (DIE (0x80) DW_TAG_formal_parameter */
90 .4byte OFFSET (8d) /* DW_AT_type */
91 .byte 0x1 /* DW_AT_artificial */
94 .uleb128 0x3 /* (DIE (0x86) DW_TAG_formal_parameter */
95 .4byte OFFSET (93) /* DW_AT_type */
96 .byte 0x0 /* DW_AT_artificial */
97 .byte 0 /* end of children of DIE 0x72 */
98 .byte 0 /* end of children of DIE 0x66 */
101 .uleb128 0x5 /* (DIE (0x8d) DW_TAG_pointer_type */
102 .byte 0x4 /* DW_AT_size */
103 .4byte OFFSET (66) /* DW_AT_type */
106 .uleb128 0x8 /* (DIE (0x93) DW_TAG_structure_type */
107 .byte 0x10 /* DW_AT_byte_size */
108 .4byte OFFSET (b4) /* DW_AT_sibling */
111 .uleb128 0x9 /* (DIE (0x9b) DW_TAG_member */
112 .ascii "__pfn\0" /* DW_AT_name */
113 .4byte OFFSET (c8) /* DW_AT_type */
114 .byte 0 /* DW_AT_data_member_location */
117 .uleb128 0x9 /* (DIE (0xa7) DW_TAG_member */
118 .ascii "__delta\0" /* DW_AT_name */
119 .4byte OFFSET (ce) /* DW_AT_type */
120 .byte 0x8 /* DW_AT_data_member_location */
121 .byte 0 /* end of children of DIE 0x93 */
124 .uleb128 0xa /* (DIE (0xb4) DW_TAG_subroutine_type) */
125 .4byte OFFSET (59) /* DW_AT_type */
126 .4byte OFFSET (c1) /* DW_AT_object_pointer */
127 .4byte OFFSET (c8) /* DW_AT_sibling */
130 .uleb128 0x3 /* (DIE (0xc1) DW_TAG_formal_parameter) */
131 .4byte OFFSET (60) /* DW_AT_type */
132 .byte 0x1 /* DW_AT_artificial */
133 .byte 0 /* end of children of DIE 0xb4 */
136 .uleb128 0x5 /* (DIE (0xc8) DW_TAG_pointer_type) */
137 .byte 0x4 /* DW_AT_byte_size */
138 .4byte OFFSET (b4) /* DW_AT_type */
141 .uleb128 0x4 /* (DIE (0xce) DW_TAG_base_type) */
142 .byte 0x8 /* DW_AT_byte_size */
143 .byte 0x5 /* DW_AT_encoding */
144 .ascii "long int\0" /* DW_AT_name */
147 .uleb128 0xc /* (DIE (0x107) DW_TAG_subprogram) */
148 .4byte OFFSET (72) /* DW_AT_specification */
149 .byte 0x2 /* DW_AT_inline */
150 .4byte OFFSET (115) /* DW_AT_object_pointer */
151 .4byte OFFSET (12a) /* DW_AT_sibling */
154 .uleb128 0xd /* (DIE (0x115) DW_TAG_formal_parameter) */
155 .ascii "this\0" /* DW_AT_name */
156 .4byte OFFSET (12a) /* DW_AT_type */
157 .byte 0x1 /* DW_AT_artificial */
160 .uleb128 0xd /* (DIE (0x11f) DW_TAG_formal_parameter) */
161 .ascii "mp\0" /* DW_AT_name */
162 .4byte OFFSET (93) /* DW_AT_type */
163 .byte 0x0 /* DW_AT_artificial */
164 .byte 0 /* end of children of DIE 0x107 */
167 .uleb128 0xb /* (DIE (0x12a) DW_TAG_const_type) */
168 .4byte OFFSET (8d) /* DW_AT_type */
171 .uleb128 0xe /* (DIE (0x12f) DW_TAG_subprogram) */
172 .4byte OFFSET (107) /* DW_AT_abstract_origin */
173 .4byte 0x20 /* DW_AT_low_pc */
174 .4byte 0x2c /* DW_AT_high_pc */
175 .4byte OFFSET (14e) /* DW_AT_object_pointer */
178 .uleb128 0xf /* (DIE (0x14e) DW_TAG_formal_parameter) */
179 .4byte OFFSET (115) /* DW_AT_abstract_origin */
180 .byte 0x2 /* DW_AT_location */
185 .uleb128 0xf /* (DIE (0x156) DW_TAG_formal_parameter) */
186 .4byte OFFSET (11f) /* DW_at_abstract_origin */
187 .byte 0x2 /* DW_AT_location */
190 .byte 0 /* end of children of DIE 0x12f */
191 .byte 0 /* end of children of DIE 0x5b */
195 .section .debug_abbrev
196 .uleb128 0x1 /* (abbrev code) */
197 .uleb128 0x11 /* (TAG: DW_TAG_compile_unit) */
198 .byte 0x1 /* DW_children_yes */
199 .uleb128 0x25 /* (DW_AT_producer) */
200 .uleb128 0x8 /* (DW_FORM_string) */
201 .uleb128 0x13 /* (DW_AT_language) */
202 .uleb128 0xb /* (DW_FORM_data1) */
203 .uleb128 0x3 /* (DW_AT_name) */
204 .uleb128 0x8 /* (DW_FORM_string) */
205 .uleb128 0x10 /* (DW_AT_stmt_list) */
206 .uleb128 0x6 /* (DW_FORM_data4) */
210 .uleb128 0x2 /* (abbrev code) */
211 .uleb128 0x2 /* (TAG: DW_TAG_class_type) */
212 .byte 0x0 /* DW_children_no */
214 /* This is the "fudging" part... */
215 .uleb128 0x3 /* (DW_AT_name) */
216 .uleb128 0x8 /* (DW_FORM_string) */
218 .uleb128 0xb /* (DW_AT_byte_size) */
219 .uleb128 0xb /* (DW_FORM_data1) */
223 .uleb128 0x3 /* (abbrev code) */
224 .uleb128 0x5 /* (TAG: DW_TAG_formal_parameter) */
225 .byte 0 /* DW_children_no */
226 .uleb128 0x49 /* (DW_AT_type) */
227 .uleb128 0x13 /* (DW_FORM_ref4) */
228 .uleb128 0x34 /* (DW_AT_artificial) */
229 .uleb128 0xc /* (DW_FORM_flag) */
233 .uleb128 0x4 /* (abbrev code) */
234 .uleb128 0x24 /* (TAG: DW_TAG_base_type) */
235 .byte 0 /* DW_children_no */
236 .uleb128 0xb /* (DW_AT_byte_size) */
237 .uleb128 0xb /* (DW_FORM_data1) */
238 .uleb128 0x3e /* (DW_AT_encoding) */
239 .uleb128 0xb /* (DW_FORM_data1) */
240 .uleb128 0x3 /* (DW_AT_name) */
241 .uleb128 0x8 /* (DW_FORM_string) */
245 .uleb128 0x5 /* (abbrev code) */
246 .uleb128 0xf /* (TAG: DW_TAG_pointer_type) */
247 .byte 0 /* DW_children_no */
248 .uleb128 0xb /* (DW_AT_byte_size) */
249 .uleb128 0xb /* (DW_FORM_data1) */
250 .uleb128 0x49 /* (DW_AT_type) */
251 .uleb128 0x13 /* (DW_FORM_ref4) */
255 .uleb128 0x6 /* (abbrev code) */
256 .uleb128 0x2 /* (TAG: DW_TAG_class_type) */
257 .byte 0x1 /* DW_children_yes */
258 .uleb128 0x3 /* (DW_AT_name) */
259 .uleb128 0x8 /* (DW_FORM_string) */
260 .uleb128 0xb /* (DW_AT_byte_size) */
261 .uleb128 0xb /* (DW_FORM_data1) */
262 .uleb128 0x1 /* (DW_AT_sibling) */
267 .uleb128 0x7 /* (abbrev code) */
268 .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */
269 .byte 0x1 /* DW_children_yes */
270 .uleb128 0x3f /* (DW_AT_external) */
271 .uleb128 0xc /* (DW_FORM_flag) */
272 .uleb128 0x3 /* (DW_AT_name) */
273 .uleb128 0x8 /* (DW_FORM_string) */
274 .uleb128 0x32 /* (DW_AT_accessibility) */
275 .uleb128 0xb /* (DW_FORM_data1) */
276 .uleb128 0x3c /* (DW_AT_declaration) */
277 .uleb128 0xc /* (DW_FORM_flag) */
278 .uleb128 0x64 /* (DW_AT_object_pointer) */
279 .uleb128 0x13 /* (DW_FORM_ref4) */
283 .uleb128 0x8 /* (abbrev code) */
284 .uleb128 0x13 /* (TAG: DW_TAG_structure_type) */
285 .byte 0x1 /* DW_children_yes */
286 .uleb128 0xb /* (DW_AT_byte_size) */
287 .uleb128 0xb /* (DW_FORM_data1) */
288 .uleb128 0x1 /* (DW_AT_sibling) */
289 .uleb128 0x13 /* (DW_FORM_ref4) */
293 .uleb128 0x9 /* (abbrev code) */
294 .uleb128 0xd /* (TAG: DW_TAG_member) */
295 .byte 0 /* DW_children_no */
296 .uleb128 0x3 /* (DW_AT_name) */
297 .uleb128 0x8 /* (DW_FORM_string) */
298 .uleb128 0x49 /* (DW_AT_type) */
299 .uleb128 0x13 /* (DW_FORM_ref4) */
300 .uleb128 0x38 /* (DW_AT_data_member_location) */
301 .uleb128 0xb /* (DW_FORM_data1) */
305 .uleb128 0xa /* (abbrev code) */
306 .uleb128 0x15 /* (TAG: DW_TAG_subroutine_type) */
307 .byte 0x1 /* DW_children_yes */
308 .uleb128 0x49 /* (DW_AT_type) */
309 .uleb128 0x13 /* (DW_FORM_ref4) */
310 .uleb128 0x64 /* (DW_AT_object_pointer) */
311 .uleb128 0x13 /* (DW_FORM_ref4) */
312 .uleb128 0x1 /* (DW_AT_sibling) */
313 .uleb128 0x13 /* (DW_FORM_ref4) */
317 .uleb128 0xb /* (abbrev code) */
318 .uleb128 0x26 /* (TAG: DW_TAG_const_type) */
319 .byte 0 /* DW_children_no */
320 .uleb128 0x49 /* (DW_AT_type) */
321 .uleb128 0x13 /* (DW_FORM_ref4) */
325 .uleb128 0xc /* (abbrev code) */
326 .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */
327 .byte 0x1 /* DW_children_yes */
328 .uleb128 0x47 /* (DW_AT_specification) */
329 .uleb128 0x13 /* (DW_FORM_ref4) */
330 .uleb128 0x20 /* (DW_AT_inline) */
331 .uleb128 0xb /* (DW_FORM_data1) */
332 .uleb128 0x64 /* (DW_AT_object_pointer) */
333 .uleb128 0x13 /* (DW_FORM_ref4) */
334 .uleb128 0x1 /* (DW_AT_sibling) */
335 .uleb128 0x13 /* (DW_FORM_ref4) */
339 .uleb128 0xd /* (abbrev code) */
340 .uleb128 0x5 /* (TAG: DW_TAG_formal_parameter) */
341 .byte 0 /* DW_children_no */
342 .uleb128 0x3 /* (DW_AT_name) */
343 .uleb128 0x8 /* (DW_FORM_string) */
344 .uleb128 0x49 /* (DW_AT_type) */
345 .uleb128 0x13 /* (DW_FORM_ref4) */
346 .uleb128 0x34 /* (DW_AT_artificial) */
347 .uleb128 0xc /* (DW_FORM_flag) */
351 .uleb128 0xe /* (abbrev code) */
352 .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */
353 .byte 0x1 /* DW_children_yes */
354 .uleb128 0x31 /* (DW_AT_abstract_origin) */
355 .uleb128 0x13 /* (DW_FORM_ref4) */
356 .uleb128 0x11 /* (DW_AT_low_pc) */
357 .uleb128 0x13 /* (DW_FORM_ref4) */
358 .uleb128 0x12 /* (DW_AT_high_pc) */
359 .uleb128 0x13 /* (DW_FORM_ref4) */
360 .uleb128 0x64 /* (DW_AT_object_pointer) */
361 .uleb128 0x13 /* (DW_FORM_ref4) */
365 .uleb128 0xf /* (abbrev code) */
366 .uleb128 0x5 /* (TAG: DW_TAG_formal_parameter) */
367 .byte 0 /* DW_children_no */
368 .uleb128 0x31 /* (DW_AT_abstract_origin) */
369 .uleb128 0x13 /* (DW_FORM_ref4) */
370 .uleb128 0x2 /* (DW_AT_location) */
371 .uleb128 0xa /* (DW_FORM_block) */