1 /* Copyright 2012-2023 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.
34 And then manually edited to insert the necessary DW_AT_specification
35 entries to trigger the desired code path.
36 There's no real need to make this architecture-specific, so it has been
37 further hand-edited to support that.
40 #define CONCAT1(a, b) CONCAT2(a, b)
41 #define CONCAT2(a, b) a ## b
44 # define SYMBOL(str) CONCAT1(SYMBOL_PREFIX, str)
46 # define SYMBOL(str) str
52 .data /* Previously this used .bss, but it's not portable. */
58 /* This is disabled because when it was accidentally left out it
59 caused a segv when used with .gdb_index. */
68 .type SYMBOL(main), %function
73 .size SYMBOL(main), .-SYMBOL(main)
76 .section .debug_types,"",%progbits
78 .4byte .Ltu_end - .Ltu_start /* Length of Compilation Unit Info */
80 .2byte 0x4 /* DWARF version number */
81 .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
82 .byte 0x4 /* Pointer Size (in bytes) */
83 .byte 0x19 /* Type Signature */
91 .4byte .Ltu_class_type - .Ldebug_types0 /* Offset to Type DIE */
92 .uleb128 0x1 /* DW_TAG_type_unit */
93 .byte 0x4 /* DW_AT_language */
94 .byte 0x73 /* DW_AT_GNU_odr_signature */
102 .4byte .Ldebug_line0 /* DW_AT_stmt_list */
104 /* Manually inserted to have a DW_AT_specification refering to
105 something and appearing ahead of it. */
106 .uleb128 0x8 /* DW_TAG_class_type */
107 .4byte .Ltu_class_type - .Ldebug_types0
108 /* End of manual insertion */
111 .uleb128 0x2 /* (DW_TAG_class_type) */
112 .ascii "foo\0" /* DW_AT_name */
113 .byte 0x4 /* DW_AT_byte_size */
114 .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */
115 .byte 0x1 /* DW_AT_decl_line */
116 .4byte .Ltu_base_type - .Ldebug_types0 /* DW_AT_sibling */
118 .uleb128 0x3 /* (DW_TAG_member) */
119 .ascii "bar\0" /* DW_AT_name */
120 .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */
121 .byte 0x4 /* DW_AT_decl_line */
122 .4byte .Ltu_base_type - .Ldebug_types0 /* DW_AT_type */
123 .byte 0 /* DW_AT_data_member_location */
124 .byte 0x1 /* DW_AT_accessibility */
125 .byte 0 /* end of children */
128 .uleb128 0x4 /* DW_TAG_base_type */
129 .byte 0x4 /* DW_AT_byte_size */
130 .byte 0x5 /* DW_AT_encoding */
131 .ascii "int\0" /* DW_AT_name */
132 .byte 0 /* end of children */
136 .section .debug_info,"",%progbits
138 .4byte .Lcu_end - .Lcu_start /* Length of Compilation Unit Info */
140 .2byte 0x4 /* DWARF version number */
141 .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
142 .byte 0x4 /* Pointer Size (in bytes) */
144 .uleb128 0x5 /* (DW_TAG_compile_unit) */
145 .4byte .LASF0 /* DW_AT_producer: "GNU C++ 4.6.3 20120306" */
146 .byte 0x4 /* DW_AT_language */
147 .4byte .LASF1 /* DW_AT_name: "pr13961.cc" */
148 .4byte .LASF2 /* DW_AT_comp_dir: "." */
149 .4byte .Ltext0 /* DW_AT_low_pc */
150 .4byte .Letext0 /* DW_AT_high_pc */
151 .4byte .Ldebug_line0 /* DW_AT_stmt_list */
154 .uleb128 0x4 /* DW_TAG_base_type */
155 .byte 0x4 /* DW_AT_byte_size */
156 .byte 0x5 /* DW_AT_encoding */
157 .ascii "int\0" /* DW_AT_name */
159 .uleb128 0x6 /* DW_TAG_subprogram */
161 .4byte .LASF3 /* DW_AT_name: "main" */
162 .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */
163 .byte 0xa /* DW_AT_decl_line */
164 .4byte .Lint_base_type - .Ldebug_info0 /* DW_AT_type */
165 .4byte .LFB0 /* DW_AT_low_pc */
166 .4byte .LFE0 /* DW_AT_high_pc */
167 .uleb128 0x1 /* DW_AT_frame_base */
168 .byte 0x9c /* DW_OP_call_frame_cfa */
169 /* DW_AT_GNU_all_call_sites */
171 .uleb128 0x7 /* DW_TAG_variable */
172 .ascii "baz\0" /* DW_AT_name */
173 .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */
174 .byte 0x7 /* DW_AT_decl_line */
175 .byte 0x19 /* DW_AT_type */
184 .uleb128 0x5 /* DW_AT_location */
185 .byte 0x3 /* DW_OP_addr */
188 /* Manually inserted to have a DW_AT_specification refering to
189 something and appearing ahead of it. */
190 .uleb128 0x8 /* DW_TAG_class_type */
191 .4byte .Lcu_class_type - .Ldebug_info0 /* DW_AT_specification */
194 .uleb128 0x4 /* DW_TAG_base_type */
195 .byte 0x4 /* DW_AT_byte_size */
196 .byte 0x5 /* DW_AT_encoding */
197 .ascii "int\0" /* DW_AT_name */
200 .uleb128 0x2 /* DW_TAG_class_type */
201 .ascii "foo2\0" /* DW_AT_name */
202 .byte 0x4 /* DW_AT_byte_size */
203 .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */
204 .byte 0x1 /* DW_AT_decl_line */
205 .4byte .Lcu_second_int_type - .Ldebug_info0 /* DW_AT_sibling */
207 .uleb128 0x3 /* DW_TAG_member */
208 .ascii "bar\0" /* DW_AT_name */
209 .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */
210 .byte 0x4 /* DW_AT_decl_line */
211 .4byte .Lcu_second_int_type - .Ldebug_info0 /* DW_AT_type */
212 .byte 0 /* DW_AT_data_member_location */
213 .byte 0x1 /* DW_AT_accessibility */
214 .byte 0 /* end of children */
216 .Lcu_second_int_type:
217 .uleb128 0x4 /* DW_TAG_base_type */
218 .byte 0x4 /* DW_AT_byte_size */
219 .byte 0x5 /* DW_AT_encoding */
220 .ascii "int\0" /* DW_AT_name */
221 /* End of manual insertion */
223 .byte 0 /* end of children */
227 .section .debug_abbrev,"",%progbits
229 .uleb128 0x1 /* (abbrev code) */
230 .uleb128 0x41 /* (TAG: DW_TAG_type_unit) */
231 .byte 0x1 /* DW_children_yes */
232 .uleb128 0x13 /* (DW_AT_language) */
233 .uleb128 0xb /* (DW_FORM_data1) */
234 .uleb128 0x210f /* (DW_AT_GNU_odr_signature) */
235 .uleb128 0x7 /* (DW_FORM_data8) */
236 .uleb128 0x10 /* (DW_AT_stmt_list) */
237 .uleb128 0x17 /* (DW_FORM_sec_offset) */
240 .uleb128 0x2 /* (abbrev code) */
241 .uleb128 0x2 /* (TAG: DW_TAG_class_type) */
242 .byte 0x1 /* DW_children_yes */
243 .uleb128 0x3 /* (DW_AT_name) */
244 .uleb128 0x8 /* (DW_FORM_string) */
245 .uleb128 0xb /* (DW_AT_byte_size) */
246 .uleb128 0xb /* (DW_FORM_data1) */
247 .uleb128 0x3a /* (DW_AT_decl_file) */
248 .uleb128 0xb /* (DW_FORM_data1) */
249 .uleb128 0x3b /* (DW_AT_decl_line) */
250 .uleb128 0xb /* (DW_FORM_data1) */
251 .uleb128 0x1 /* (DW_AT_sibling) */
252 .uleb128 0x13 /* (DW_FORM_ref4) */
255 .uleb128 0x3 /* (abbrev code) */
256 .uleb128 0xd /* (TAG: DW_TAG_member) */
257 .byte 0 /* DW_children_no */
258 .uleb128 0x3 /* (DW_AT_name) */
259 .uleb128 0x8 /* (DW_FORM_string) */
260 .uleb128 0x3a /* (DW_AT_decl_file) */
261 .uleb128 0xb /* (DW_FORM_data1) */
262 .uleb128 0x3b /* (DW_AT_decl_line) */
263 .uleb128 0xb /* (DW_FORM_data1) */
264 .uleb128 0x49 /* (DW_AT_type) */
265 .uleb128 0x13 /* (DW_FORM_ref4) */
266 .uleb128 0x38 /* (DW_AT_data_member_location) */
267 .uleb128 0xb /* (DW_FORM_data1) */
268 .uleb128 0x32 /* (DW_AT_accessibility) */
269 .uleb128 0xb /* (DW_FORM_data1) */
272 .uleb128 0x4 /* (abbrev code) */
273 .uleb128 0x24 /* (TAG: DW_TAG_base_type) */
274 .byte 0 /* DW_children_no */
275 .uleb128 0xb /* (DW_AT_byte_size) */
276 .uleb128 0xb /* (DW_FORM_data1) */
277 .uleb128 0x3e /* (DW_AT_encoding) */
278 .uleb128 0xb /* (DW_FORM_data1) */
279 .uleb128 0x3 /* (DW_AT_name) */
280 .uleb128 0x8 /* (DW_FORM_string) */
283 .uleb128 0x5 /* (abbrev code) */
284 .uleb128 0x11 /* (TAG: DW_TAG_compile_unit) */
285 .byte 0x1 /* DW_children_yes */
286 .uleb128 0x25 /* (DW_AT_producer) */
287 .uleb128 0xe /* (DW_FORM_strp) */
288 .uleb128 0x13 /* (DW_AT_language) */
289 .uleb128 0xb /* (DW_FORM_data1) */
290 .uleb128 0x3 /* (DW_AT_name) */
291 .uleb128 0xe /* (DW_FORM_strp) */
292 .uleb128 0x1b /* (DW_AT_comp_dir) */
293 .uleb128 0xe /* (DW_FORM_strp) */
294 .uleb128 0x11 /* (DW_AT_low_pc) */
295 .uleb128 0x1 /* (DW_FORM_addr) */
296 .uleb128 0x12 /* (DW_AT_high_pc) */
297 .uleb128 0x1 /* (DW_FORM_addr) */
298 .uleb128 0x10 /* (DW_AT_stmt_list) */
299 .uleb128 0x17 /* (DW_FORM_sec_offset) */
302 .uleb128 0x6 /* (abbrev code) */
303 .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */
304 .byte 0 /* DW_children_no */
305 .uleb128 0x3f /* (DW_AT_external) */
306 .uleb128 0x19 /* (DW_FORM_flag_present) */
307 .uleb128 0x3 /* (DW_AT_name) */
308 .uleb128 0xe /* (DW_FORM_strp) */
309 .uleb128 0x3a /* (DW_AT_decl_file) */
310 .uleb128 0xb /* (DW_FORM_data1) */
311 .uleb128 0x3b /* (DW_AT_decl_line) */
312 .uleb128 0xb /* (DW_FORM_data1) */
313 .uleb128 0x49 /* (DW_AT_type) */
314 .uleb128 0x13 /* (DW_FORM_ref4) */
315 .uleb128 0x11 /* (DW_AT_low_pc) */
316 .uleb128 0x1 /* (DW_FORM_addr) */
317 .uleb128 0x12 /* (DW_AT_high_pc) */
318 .uleb128 0x1 /* (DW_FORM_addr) */
319 .uleb128 0x40 /* (DW_AT_frame_base) */
320 .uleb128 0x18 /* (DW_FORM_exprloc) */
321 .uleb128 0x2117 /* (DW_AT_GNU_all_call_sites) */
322 .uleb128 0x19 /* (DW_FORM_flag_present) */
325 .uleb128 0x7 /* (abbrev code) */
326 .uleb128 0x34 /* (TAG: DW_TAG_variable) */
327 .byte 0 /* DW_children_no */
328 .uleb128 0x3 /* (DW_AT_name) */
329 .uleb128 0x8 /* (DW_FORM_string) */
330 .uleb128 0x3a /* (DW_AT_decl_file) */
331 .uleb128 0xb /* (DW_FORM_data1) */
332 .uleb128 0x3b /* (DW_AT_decl_line) */
333 .uleb128 0xb /* (DW_FORM_data1) */
334 .uleb128 0x49 /* (DW_AT_type) */
335 .uleb128 0x20 /* (DW_FORM_ref_sig8) */
336 .uleb128 0x3f /* (DW_AT_external) */
337 .uleb128 0x19 /* (DW_FORM_flag_present) */
338 .uleb128 0x2 /* (DW_AT_location) */
339 .uleb128 0x18 /* (DW_FORM_exprloc) */
343 /* Manually inserted. */
344 .uleb128 0x8 /* abbrev code */
345 .uleb128 0x2 /* DW_TAG_class_type */
346 .byte 0x0 /* DW_has_children_no */
347 .uleb128 0x47 /* DW_AT_specification */
348 .uleb128 0x13 /* DW_FORM_ref4 */
349 .byte 0x0 /* Terminator */
350 .byte 0x0 /* Terminator */
351 /* End of manual insertion. */
355 .section .debug_aranges,"",%progbits
356 .4byte 0x1c /* Length of Address Ranges Info */
357 .2byte 0x2 /* DWARF Version */
358 .4byte .Ldebug_info0 /* Offset of Compilation Unit Info */
359 .byte 0x4 /* Size of Address */
360 .byte 0 /* Size of Segment Descriptor */
361 .2byte 0 /* Pad to 8 byte boundary */
363 .4byte .Ltext0 /* Address */
364 .4byte .Letext0-.Ltext0 /* Length */
368 .section .debug_line,"",%progbits
371 .section .debug_str,"MS",%progbits,1
373 .string "GNU C++ 4.6.3 20120306"
381 .section .note.GNU-stack,"",@progbits