1 /* Copyright 2012-2022 Free Software Foundation, Inc.
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 3 of the License, or
6 (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */
16 /* Testcase to exercise the code path in bug 13961 for Fission.
17 http://gcc.gnu.org/wiki/DebugFission
35 And then manually edited to insert the necessary DW_AT_specification
36 entries to trigger the desired code path.
37 There's no real need to make this architecture-specific, so it has been
38 further hand-edited to support that.
41 #define CONCAT1(a, b) CONCAT2(a, b)
42 #define CONCAT2(a, b) a ## b
45 # define SYMBOL(str) CONCAT1(SYMBOL_PREFIX, str)
47 # define SYMBOL(str) str
50 .file "fission-reread.cc"
53 .data /* Previously this used .bss, but it's not portable. */
55 .type SYMBOL(baz), %object
63 .type SYMBOL(main), %function
66 .file 1 "fission-reread.cc"
70 .size SYMBOL(main), .-SYMBOL(main)
73 .section .debug_types.dwo
75 .4byte .Ltu_end_dwo - .Ltu_start_dwo - 4 /* Length of Compilation Unit Info */
76 .2byte 0x4 /* DWARF version number */
77 .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
78 .byte 0x4 /* Pointer Size (in bytes) */
79 .byte 0x19 /* Type Signature */
87 .4byte .Ltu_class_type - .Ltu_start_dwo /* Offset to Type DIE */
88 .uleb128 0x1 /* (DIE (0x17) DW_TAG_type_unit) */
89 .byte 0x4 /* DW_AT_language */
90 .byte 0x73 /* DW_AT_GNU_odr_signature */
98 .4byte .Lskeleton_debug_line0 /* DW_AT_stmt_list */
100 /* Manually inserted to have a DW_AT_specification refering to
101 something and appearing ahead of it. */
102 .uleb128 0x8 /* DW_TAG_class_type */
103 .4byte .Ltu_class_type - .Ltu_start_dwo
104 /* End of manual insertion */
107 .uleb128 0x2 /* (DIE (0x25) DW_TAG_class_type) */
108 .ascii "foo\0" /* DW_AT_name */
109 .byte 0x4 /* DW_AT_byte_size */
110 .byte 0x1 /* DW_AT_decl_file (fission-reread.cc) */
111 .byte 0x1 /* DW_AT_decl_line */
112 .4byte .Ltu_int - .Ltu_start_dwo /* DW_AT_sibling */
113 .uleb128 0x3 /* (DIE (0x31) DW_TAG_member) */
114 .ascii "bar\0" /* DW_AT_name */
115 .byte 0x1 /* DW_AT_decl_file (fission-reread.cc) */
116 .byte 0x4 /* DW_AT_decl_line */
117 .4byte .Ltu_int - .Ltu_start_dwo /* DW_AT_type */
118 .byte 0 /* DW_AT_data_member_location */
119 .byte 0x1 /* DW_AT_accessibility */
120 .byte 0 /* end of children of DIE 0x25 */
122 .uleb128 0x4 /* (DIE (0x3f) DW_TAG_base_type) */
123 .byte 0x4 /* DW_AT_byte_size */
124 .byte 0x5 /* DW_AT_encoding */
125 .ascii "int\0" /* DW_AT_name */
126 .byte 0 /* end of children of DIE 0x17 */
129 .section .debug_types
131 .4byte .Ltu_end - .Ltu_start - 4 /* Length of Type Unit Info */
132 .2byte 0x4 /* DWARF version number */
133 .4byte .Lskeleton_debug_abbrev0 /* Offset Into Abbrev. Section */
134 .byte 0x4 /* Pointer Size (in bytes) */
135 .byte 0x19 /* Type Signature */
143 .4byte 0 /* Offset to Type DIE */
144 .uleb128 0x2 /* (DIE (0) DW_TAG_type_unit) */
145 .ascii "/tmp/src/gdb/testsuite\0" /* DW_AT_comp_dir */
146 .asciz DWO /* DW_AT_GNU_dwo_name */
147 .4byte .Ldebug_pubnames0 /* DW_AT_GNU_pubnames */
148 .4byte .Ldebug_pubtypes0 /* DW_AT_GNU_pubtypes */
149 .4byte .Ldebug_addr0 /* DW_AT_GNU_addr_base */
152 .section .debug_info.dwo
154 .4byte .Lcu_end_dwo - .Lcu_start_dwo - 4 /* Length of Compilation Unit Info */
155 .2byte 0x4 /* DWARF version number */
156 .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
157 .byte 0x4 /* Pointer Size (in bytes) */
158 .uleb128 0x5 /* (DIE (0xb) DW_TAG_compile_unit) */
159 .ascii "GNU C++ 4.6.x-fission\0" /* DW_AT_producer */
160 .byte 0x4 /* DW_AT_language */
161 .ascii "gdb.dwarf2/fission-reread.cc\0" /* DW_AT_name */
162 .ascii "/tmp/src/gdb/testsuite\0" /* DW_AT_comp_dir */
163 .byte 1 /* DW_AT_GNU_dwo_id */
172 .uleb128 0x4 /* (DIE (0x7f) DW_TAG_base_type) */
173 .byte 0x4 /* DW_AT_byte_size */
174 .byte 0x5 /* DW_AT_encoding */
175 .ascii "int\0" /* DW_AT_name */
176 .uleb128 0x6 /* (DIE (0x86) DW_TAG_subprogram) */
178 .ascii "main\0" /* DW_AT_name */
179 .byte 0x1 /* DW_AT_decl_file (fission-reread.cc) */
180 .byte 0xa /* DW_AT_decl_line */
181 .4byte .Lcu_int - .Lcu_start_dwo /* DW_AT_type */
182 .uleb128 0 /* DW_AT_low_pc */
183 .4byte .LFE0-.LFB0 /* DW_AT_high_pc */
184 .uleb128 0x1 /* DW_AT_frame_base */
185 .byte 0x9c /* DW_OP_call_frame_cfa */
186 .uleb128 0x7 /* (DIE (0x9d) DW_TAG_variable) */
187 .ascii "baz\0" /* DW_AT_name */
188 .byte 0x1 /* DW_AT_decl_file (fission-reread.cc) */
189 .byte 0x7 /* DW_AT_decl_line */
190 .byte 0x19 /* DW_AT_type */
199 .uleb128 0x2 /* DW_AT_location */
200 .byte 0xfb /* DW_OP_GNU_addr_index */
201 .uleb128 0x1 /* (index into .debug_addr) */
202 .byte 0 /* end of children of DIE 0xb */
206 .Lskeleton_debug_info0:
208 .4byte .Lcu_end - .Lcu_start - 4 /* Length of Compilation Unit Info */
209 .2byte 0x4 /* DWARF version number */
210 .4byte .Lskeleton_debug_abbrev0 /* Offset Into Abbrev. Section */
211 .byte 0x4 /* Pointer Size (in bytes) */
212 .uleb128 0x1 /* (DIE (0) DW_TAG_compile_unit) */
213 .4byte .Ltext0 /* DW_AT_low_pc */
214 .4byte .Letext0-.Ltext0 /* DW_AT_high_pc */
215 .4byte .Ldebug_line0 /* DW_AT_stmt_list */
216 .ascii "/tmp/src/gdb/testsuite\0" /* DW_AT_comp_dir */
217 .asciz DWO /* DW_AT_GNU_dwo_name */
218 .4byte .Ldebug_pubnames0 /* DW_AT_GNU_pubnames */
219 .4byte .Ldebug_pubtypes0 /* DW_AT_GNU_pubtypes */
220 .4byte .Ldebug_addr0 /* DW_AT_GNU_addr_base */
221 .byte 1 /* DW_AT_GNU_dwo_id */
231 .section .debug_abbrev
232 .Lskeleton_debug_abbrev0:
233 .uleb128 0x1 /* (abbrev code) */
234 .uleb128 0x11 /* (TAG: DW_TAG_compile_unit) */
235 .byte 0 /* DW_children_no */
236 .uleb128 0x11 /* (DW_AT_low_pc) */
237 .uleb128 0x1 /* (DW_FORM_addr) */
238 .uleb128 0x12 /* (DW_AT_high_pc) */
239 .uleb128 0x6 /* (DW_FORM_data4) */
240 .uleb128 0x10 /* (DW_AT_stmt_list) */
241 .uleb128 0x17 /* (DW_FORM_sec_offset) */
242 .uleb128 0x1b /* (DW_AT_comp_dir) */
243 .uleb128 0x8 /* (DW_FORM_string) */
244 .uleb128 0x2130 /* (DW_AT_GNU_dwo_name) */
245 .uleb128 0x8 /* (DW_FORM_string) */
246 .uleb128 0x2134 /* (DW_AT_GNU_pubnames) */
247 .uleb128 0x17 /* (DW_FORM_sec_offset) */
248 .uleb128 0x2135 /* (DW_AT_GNU_pubtypes) */
249 .uleb128 0x17 /* (DW_FORM_sec_offset) */
250 .uleb128 0x2133 /* (DW_AT_GNU_addr_base) */
251 .uleb128 0x17 /* (DW_FORM_sec_offset) */
252 .uleb128 0x2131 /* (DW_AT_GNU_dwo_id) */
253 .uleb128 0x7 /* (DW_FORM_data8) */
256 .uleb128 0x2 /* (abbrev code) */
257 .uleb128 0x41 /* (TAG: DW_TAG_type_unit) */
258 .byte 0 /* DW_children_no */
259 .uleb128 0x1b /* (DW_AT_comp_dir) */
260 .uleb128 0x8 /* (DW_FORM_string) */
261 .uleb128 0x2130 /* (DW_AT_GNU_dwo_name) */
262 .uleb128 0x8 /* (DW_FORM_string) */
263 .uleb128 0x2134 /* (DW_AT_GNU_pubnames) */
264 .uleb128 0x17 /* (DW_FORM_sec_offset) */
265 .uleb128 0x2135 /* (DW_AT_GNU_pubtypes) */
266 .uleb128 0x17 /* (DW_FORM_sec_offset) */
267 .uleb128 0x2133 /* (DW_AT_GNU_addr_base) */
268 .uleb128 0x17 /* (DW_FORM_sec_offset) */
271 .byte 0 /* end of skeleton .debug_abbrev */
272 .section .debug_abbrev.dwo
274 .uleb128 0x1 /* (abbrev code) */
275 .uleb128 0x41 /* (TAG: DW_TAG_type_unit) */
276 .byte 0x1 /* DW_children_yes */
277 .uleb128 0x13 /* (DW_AT_language) */
278 .uleb128 0xb /* (DW_FORM_data1) */
279 .uleb128 0x210f /* (DW_AT_GNU_odr_signature) */
280 .uleb128 0x7 /* (DW_FORM_data8) */
281 .uleb128 0x10 /* (DW_AT_stmt_list) */
282 .uleb128 0x17 /* (DW_FORM_sec_offset) */
285 .uleb128 0x2 /* (abbrev code) */
286 .uleb128 0x2 /* (TAG: DW_TAG_class_type) */
287 .byte 0x1 /* DW_children_yes */
288 .uleb128 0x3 /* (DW_AT_name) */
289 .uleb128 0x8 /* (DW_FORM_string) */
290 .uleb128 0xb /* (DW_AT_byte_size) */
291 .uleb128 0xb /* (DW_FORM_data1) */
292 .uleb128 0x3a /* (DW_AT_decl_file) */
293 .uleb128 0xb /* (DW_FORM_data1) */
294 .uleb128 0x3b /* (DW_AT_decl_line) */
295 .uleb128 0xb /* (DW_FORM_data1) */
296 .uleb128 0x1 /* (DW_AT_sibling) */
297 .uleb128 0x13 /* (DW_FORM_ref4) */
300 .uleb128 0x3 /* (abbrev code) */
301 .uleb128 0xd /* (TAG: DW_TAG_member) */
302 .byte 0 /* DW_children_no */
303 .uleb128 0x3 /* (DW_AT_name) */
304 .uleb128 0x8 /* (DW_FORM_string) */
305 .uleb128 0x3a /* (DW_AT_decl_file) */
306 .uleb128 0xb /* (DW_FORM_data1) */
307 .uleb128 0x3b /* (DW_AT_decl_line) */
308 .uleb128 0xb /* (DW_FORM_data1) */
309 .uleb128 0x49 /* (DW_AT_type) */
310 .uleb128 0x13 /* (DW_FORM_ref4) */
311 .uleb128 0x38 /* (DW_AT_data_member_location) */
312 .uleb128 0xb /* (DW_FORM_data1) */
313 .uleb128 0x32 /* (DW_AT_accessibility) */
314 .uleb128 0xb /* (DW_FORM_data1) */
317 .uleb128 0x4 /* (abbrev code) */
318 .uleb128 0x24 /* (TAG: DW_TAG_base_type) */
319 .byte 0 /* DW_children_no */
320 .uleb128 0xb /* (DW_AT_byte_size) */
321 .uleb128 0xb /* (DW_FORM_data1) */
322 .uleb128 0x3e /* (DW_AT_encoding) */
323 .uleb128 0xb /* (DW_FORM_data1) */
324 .uleb128 0x3 /* (DW_AT_name) */
325 .uleb128 0x8 /* (DW_FORM_string) */
328 .uleb128 0x5 /* (abbrev code) */
329 .uleb128 0x11 /* (TAG: DW_TAG_compile_unit) */
330 .byte 0x1 /* DW_children_yes */
331 .uleb128 0x25 /* (DW_AT_producer) */
332 .uleb128 0x8 /* (DW_FORM_string) */
333 .uleb128 0x13 /* (DW_AT_language) */
334 .uleb128 0xb /* (DW_FORM_data1) */
335 .uleb128 0x3 /* (DW_AT_name) */
336 .uleb128 0x8 /* (DW_FORM_string) */
337 .uleb128 0x1b /* (DW_AT_comp_dir) */
338 .uleb128 0x8 /* (DW_FORM_string) */
339 .uleb128 0x2131 /* (DW_AT_GNU_dwo_id) */
340 .uleb128 0x7 /* (DW_FORM_data8) */
343 .uleb128 0x6 /* (abbrev code) */
344 .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */
345 .byte 0 /* DW_children_no */
346 .uleb128 0x3f /* (DW_AT_external) */
347 .uleb128 0x19 /* (DW_FORM_flag_present) */
348 .uleb128 0x3 /* (DW_AT_name) */
349 .uleb128 0x8 /* (DW_FORM_string) */
350 .uleb128 0x3a /* (DW_AT_decl_file) */
351 .uleb128 0xb /* (DW_FORM_data1) */
352 .uleb128 0x3b /* (DW_AT_decl_line) */
353 .uleb128 0xb /* (DW_FORM_data1) */
354 .uleb128 0x49 /* (DW_AT_type) */
355 .uleb128 0x13 /* (DW_FORM_ref4) */
356 .uleb128 0x11 /* (DW_AT_low_pc) */
357 .uleb128 0x1f01 /* (DW_FORM_GNU_addr_index) */
358 .uleb128 0x12 /* (DW_AT_high_pc) */
359 .uleb128 0x6 /* (DW_FORM_data4) */
360 .uleb128 0x40 /* (DW_AT_frame_base) */
361 .uleb128 0x18 /* (DW_FORM_exprloc) */
364 .uleb128 0x7 /* (abbrev code) */
365 .uleb128 0x34 /* (TAG: DW_TAG_variable) */
366 .byte 0 /* DW_children_no */
367 .uleb128 0x3 /* (DW_AT_name) */
368 .uleb128 0x8 /* (DW_FORM_string) */
369 .uleb128 0x3a /* (DW_AT_decl_file) */
370 .uleb128 0xb /* (DW_FORM_data1) */
371 .uleb128 0x3b /* (DW_AT_decl_line) */
372 .uleb128 0xb /* (DW_FORM_data1) */
373 .uleb128 0x49 /* (DW_AT_type) */
374 .uleb128 0x20 /* (DW_FORM_ref_sig8) */
375 .uleb128 0x3f /* (DW_AT_external) */
376 .uleb128 0x19 /* (DW_FORM_flag_present) */
377 .uleb128 0x2 /* (DW_AT_location) */
378 .uleb128 0x18 /* (DW_FORM_exprloc) */
382 /* Manually inserted. */
383 .uleb128 0x8 /* abbrev code */
384 .uleb128 0x2 /* DW_TAG_class_type */
385 .byte 0x0 /* DW_has_children_no */
386 .uleb128 0x47 /* DW_AT_specification */
387 .uleb128 0x13 /* DW_FORM_ref4 */
388 .byte 0x0 /* Terminator */
389 .byte 0x0 /* Terminator */
390 /* End of manual insertion. */
393 .section .debug_pubnames
395 .4byte 0x1f /* Length of Public Names Info */
396 .2byte 0x2 /* DWARF Version */
397 .4byte .Lskeleton_debug_info0 /* Offset of Compilation Unit Info */
398 .4byte 0xb0 /* Compilation Unit Length */
399 .4byte 0x86 /* DIE offset */
400 .ascii "main\0" /* external name */
401 .4byte 0x9d /* DIE offset */
402 .ascii "baz\0" /* external name */
404 .section .debug_pubtypes
406 .4byte 0x1e /* Length of Public Type Names Info */
407 .2byte 0x2 /* DWARF Version */
408 .4byte .Lskeleton_debug_info0 /* Offset of Compilation Unit Info */
409 .4byte 0xb0 /* Compilation Unit Length */
410 .4byte 0x7f /* DIE offset */
411 .ascii "int\0" /* external name */
412 .4byte 0x25 /* DIE offset */
413 .ascii "foo\0" /* external name */
415 .section .debug_aranges
416 .4byte 0x1c /* Length of Address Ranges Info */
417 .2byte 0x2 /* DWARF Version */
418 .4byte .Lskeleton_debug_info0 /* Offset of Compilation Unit Info */
419 .byte 0x4 /* Size of Address */
420 .byte 0 /* Size of Segment Descriptor */
421 .2byte 0 /* Pad to 16 byte boundary */
423 .4byte .Ltext0 /* Address */
424 .4byte .Letext0-.Ltext0 /* Length */
429 .section .debug_line.dwo
430 .Lskeleton_debug_line0:
431 .4byte .LELT0-.LSLT0 /* Length of Source Line Info */
433 .2byte 0x4 /* DWARF Version */
434 .4byte .LELTP0-.LASLTP0 /* Prolog Length */
436 .byte 0x1 /* Minimum Instruction Length */
437 .byte 0x1 /* Maximum Operations Per Instruction */
438 .byte 0x1 /* Default is_stmt_start flag */
439 .byte 0xf6 /* Line Base Value (Special Opcodes) */
440 .byte 0xf5 /* Line Range Value (Special Opcodes) */
441 .byte 0xa /* Special Opcode Base */
442 .byte 0 /* opcode: 0x1 has 0 args */
443 .byte 0x1 /* opcode: 0x2 has 1 args */
444 .byte 0x1 /* opcode: 0x3 has 1 args */
445 .byte 0x1 /* opcode: 0x4 has 1 args */
446 .byte 0x1 /* opcode: 0x5 has 1 args */
447 .byte 0 /* opcode: 0x6 has 0 args */
448 .byte 0 /* opcode: 0x7 has 0 args */
449 .byte 0 /* opcode: 0x8 has 0 args */
450 .byte 0x1 /* opcode: 0x9 has 1 args */
451 .byte 0 /* End directory table */
452 .ascii "fission-reread.cc\0" /* File Entry: 0x1 */
456 .byte 0 /* End file name table */
461 .4byte .LFB0 /* DW_AT_low_pc */
462 .4byte SYMBOL(baz) /* DW_AT_location */