]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.dwarf2/fission-reread.S
1763fab046ccd949544f80ac603fc049d1804adc
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / fission-reread.S
1 /* Copyright 2012-2024 Free Software Foundation, Inc.
2
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.
7
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.
12
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/>. */
15
16 /* Testcase to exercise the code path in bug 13961 for Fission.
17 http://gcc.gnu.org/wiki/DebugFission
18
19 Compiled from:
20
21 class foo
22 {
23 public:
24 int bar;
25 };
26
27 foo baz;
28
29 int
30 main ()
31 {
32 return 0;
33 }
34
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.
39 */
40
41 #define CONCAT1(a, b) CONCAT2(a, b)
42 #define CONCAT2(a, b) a ## b
43
44 #ifdef SYMBOL_PREFIX
45 # define SYMBOL(str) CONCAT1(SYMBOL_PREFIX, str)
46 #else
47 # define SYMBOL(str) str
48 #endif
49
50 .file "fission-reread.cc"
51
52 .globl SYMBOL(baz)
53 .data /* Previously this used .bss, but it's not portable. */
54 .align 4
55 .type SYMBOL(baz), %object
56 .size SYMBOL(baz), 4
57 SYMBOL(baz):
58 .zero 4
59
60 .text
61 .Ltext0:
62 .globl SYMBOL(main)
63 .type SYMBOL(main), %function
64 SYMBOL(main):
65 .LFB0:
66 .file 1 "fission-reread.cc"
67 .loc 1 11 0
68 .4byte 0
69 .LFE0:
70 .size SYMBOL(main), .-SYMBOL(main)
71 .Letext0:
72
73 .section .debug_types.dwo
74 .Ltu_start_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 */
80 .byte 0x8b
81 .byte 0x7e
82 .byte 0xac
83 .byte 0xce
84 .byte 0xf1
85 .byte 0x22
86 .byte 0x90
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 */
91 .byte 0xea
92 .byte 0x85
93 .byte 0x23
94 .byte 0x75
95 .byte 0x8a
96 .byte 0x7e
97 .byte 0x87
98 .4byte .Lskeleton_debug_line0 /* DW_AT_stmt_list */
99
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 */
105
106 .Ltu_class_type:
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 */
121 .Ltu_int:
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 */
127 .Ltu_end_dwo:
128
129 .section .debug_types
130 .Ltu_start:
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 */
136 .byte 0x8b
137 .byte 0x7e
138 .byte 0xac
139 .byte 0xce
140 .byte 0xf1
141 .byte 0x22
142 .byte 0x90
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 */
150 .Ltu_end:
151
152 .section .debug_info.dwo
153 .Lcu_start_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 */
164 .byte 2
165 .byte 3
166 .byte 4
167 .byte 5
168 .byte 6
169 .byte 7
170 .byte 8
171 .Lcu_int:
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) */
177 /* DW_AT_external */
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 */
191 .byte 0x8b
192 .byte 0x7e
193 .byte 0xac
194 .byte 0xce
195 .byte 0xf1
196 .byte 0x22
197 .byte 0x90
198 /* DW_AT_external */
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 */
203 .Lcu_end_dwo:
204
205 .section .debug_info
206 .Lskeleton_debug_info0:
207 .Lcu_start:
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 */
222 .byte 2
223 .byte 3
224 .byte 4
225 .byte 5
226 .byte 6
227 .byte 7
228 .byte 8
229 .Lcu_end:
230
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) */
254 .byte 0
255 .byte 0
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) */
269 .byte 0
270 .byte 0
271 .byte 0 /* end of skeleton .debug_abbrev */
272 .section .debug_abbrev.dwo
273 .Ldebug_abbrev0:
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) */
283 .byte 0
284 .byte 0
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) */
298 .byte 0
299 .byte 0
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) */
315 .byte 0
316 .byte 0
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) */
326 .byte 0
327 .byte 0
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) */
341 .byte 0
342 .byte 0
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) */
362 .byte 0
363 .byte 0
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) */
379 .byte 0
380 .byte 0
381
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. */
391
392 .byte 0
393 .section .debug_pubnames
394 .Ldebug_pubnames0:
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 */
403 .4byte 0
404 .section .debug_pubtypes
405 .Ldebug_pubtypes0:
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 */
414 .4byte 0
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 */
422 .2byte 0
423 .4byte .Ltext0 /* Address */
424 .4byte .Letext0-.Ltext0 /* Length */
425 .4byte 0
426 .4byte 0
427 .section .debug_line
428 .Ldebug_line0:
429 .section .debug_line.dwo
430 .Lskeleton_debug_line0:
431 .4byte .LELT0-.LSLT0 /* Length of Source Line Info */
432 .LSLT0:
433 .2byte 0x4 /* DWARF Version */
434 .4byte .LELTP0-.LASLTP0 /* Prolog Length */
435 .LASLTP0:
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 */
453 .uleb128 0
454 .uleb128 0
455 .uleb128 0
456 .byte 0 /* End file name table */
457 .LELTP0:
458 .LELT0:
459 .section .debug_addr
460 .Ldebug_addr0:
461 .4byte .LFB0 /* DW_AT_low_pc */
462 .4byte SYMBOL(baz) /* DW_AT_location */
463 #ifdef __arm__
464 .section .note.GNU-stack,"",%progbits
465 #else
466 .section .note.GNU-stack,"",@progbits
467 #endif