xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.S (revision 7bdf38e5b7a28439665f2fdeff81e36913eef7dd)
1/* This testcase is part of GDB, the GNU debugger.
2
3   Copyright 2012-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/* 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:
22
23   class a
24   {
25    public:
26     int doit (void) { return 0; }
27   };
28
29  class crash
30   {
31    public:
32     crash (int (a::*mp) (void)) {}
33   };
34
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."  */
37
38#define OFFSET(LBL) .Ldie_ ## LBL - .Lcu1_begin
39
40	.section	.debug_info
41.Lcu1_begin:
42	.4byte	.Lcu1_end - .Lcu1_start /* Length of Compilation Unit Info */
43.Lcu1_start:
44	.2byte	0x3	/* DWARF version number */
45	.4byte	.Labbrev1_begin	/* Offset Into Abbrev. Section */
46	.byte	0x4	/* Pointer Size (in bytes) */
47
48.Ldie_b:
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 */
54
55.Ldie_31:
56	.uleb128 0x2	/* (DIE (0x31) DW_TAG_class_type  */
57#if 0
58	/* This is the "fudging" part...  */
59	.ascii	"a\0"	/* DW_AT_name */
60#endif
61	.byte	0x1	/* DW_AT_byte_size */
62
63.Ldie_59:
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 */
68
69.Ldie_60:
70	.uleb128 0x5	/* (DIE (0x60) DW_TAG_pointer_type) */
71	.byte	0x4	/* DW_AT_byte_size */
72	.4byte	OFFSET (31)	/* DW_AT_type */
73
74.Ldie_66:
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 */
79
80.Ldie_72:
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 */
87
88.Ldie_80:
89	.uleb128 0x3	/* (DIE (0x80) DW_TAG_formal_parameter */
90	.4byte	OFFSET (8d)	/* DW_AT_type */
91	.byte	0x1	/* DW_AT_artificial */
92
93.Ldie_86:
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 */
99
100.Ldie_8d:
101	.uleb128 0x5	/* (DIE (0x8d) DW_TAG_pointer_type */
102	.byte	0x4	/* DW_AT_size */
103	.4byte	OFFSET (66)	/* DW_AT_type */
104
105.Ldie_93:
106	.uleb128 0x8	/* (DIE (0x93) DW_TAG_structure_type */
107	.byte	0x10	/* DW_AT_byte_size */
108	.4byte	OFFSET (b4)	/* DW_AT_sibling */
109
110.Ldie_9b:
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 */
115
116.Ldie_a7:
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 */
122
123.Ldie_b4:
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 */
128
129.Ldie_c1:
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 */
134
135.Ldie_c8:
136	.uleb128 0x5	/* (DIE (0xc8) DW_TAG_pointer_type) */
137	.byte	0x4	/* DW_AT_byte_size */
138	.4byte	OFFSET (b4)	/* DW_AT_type */
139
140.Ldie_ce:
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 */
145
146.Ldie_107:
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 */
152
153.Ldie_115:
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 */
158
159.Ldie_11f:
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 */
165
166.Ldie_12a:
167	.uleb128 0xb	/* (DIE (0x12a) DW_TAG_const_type) */
168	.4byte	OFFSET (8d)	/* DW_AT_type */
169
170.Ldie_12f:
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 */
176
177.Ldie_14e:
178	.uleb128 0xf	/* (DIE (0x14e) DW_TAG_formal_parameter) */
179	.4byte	OFFSET (115)	/* DW_AT_abstract_origin */
180	.byte	0x2	/* DW_AT_location */
181	.byte	0x91
182	.sleb128 -24
183
184.Ldie_156:
185	.uleb128 0xf	/* (DIE (0x156) DW_TAG_formal_parameter) */
186	.4byte	OFFSET (11f)	/* DW_at_abstract_origin */
187	.byte	0x2	/* DW_AT_location */
188	.byte	0x91
189	.sleb128 -40
190	.byte	0	/* end of children of DIE 0x12f */
191	.byte	0	/* end of children of DIE 0x5b */
192.Lcu1_end:
193
194/* Abbrev table */
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) */
207	.byte	0
208	.byte	0
209
210	.uleb128 0x2	/* (abbrev code) */
211	.uleb128 0x2	/* (TAG: DW_TAG_class_type) */
212	.byte	0x0	/* DW_children_no */
213#if 0
214	/* This is the "fudging" part...  */
215	.uleb128 0x3	/* (DW_AT_name) */
216	.uleb128 0x8	/* (DW_FORM_string) */
217#endif
218	.uleb128 0xb	/* (DW_AT_byte_size) */
219	.uleb128 0xb	/* (DW_FORM_data1) */
220	.byte	0
221	.byte	0
222
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) */
230	.byte	0
231	.byte	0
232
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) */
242	.byte	0
243	.byte	0
244
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) */
252	.byte	0
253	.byte	0
254
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) */
263	.uleb128 0x13
264	.byte	0
265	.byte	0
266
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) */
280	.byte	0
281	.byte	0
282
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) */
290	.byte	0
291	.byte	0
292
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) */
302	.byte	0
303	.byte	0
304
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) */
314	.byte	0
315	.byte	0
316
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) */
322	.byte	0
323	.byte	0
324
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) */
336	.byte	0
337	.byte	0
338
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) */
348	.byte	0
349	.byte	0
350
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) */
362	.byte	0
363	.byte	0
364
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) */
372	.byte	0
373	.byte	0
374	.byte	0
375
376	.section	.debug_line
377.Ldebug_line0:
378	.section	.note.GNU-stack,"",@progbits
379