1/* Copyright 2012-2020 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. 17 18 Compiled from: 19 20 class foo 21 { 22 public: 23 int bar; 24 }; 25 26 foo baz; 27 28 int 29 main () 30 { 31 return 0; 32 } 33 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. 38*/ 39 40#define CONCAT1(a, b) CONCAT2(a, b) 41#define CONCAT2(a, b) a ## b 42 43#ifdef SYMBOL_PREFIX 44# define SYMBOL(str) CONCAT1(SYMBOL_PREFIX, str) 45#else 46# define SYMBOL(str) str 47#endif 48 49 .file "pr13961.cc" 50 51 .globl baz 52 .data /* Previously this used .bss, but it's not portable. */ 53 .align 4 54 .type baz, %object 55 .size baz, 4 56baz: 57#if 0 58 /* This is disabled because when it was accidentally left out it 59 caused a segv when used with .gdb_index. */ 60 .file 1 "foo.c" 61 .loc 1 12 0 62#endif 63 .zero 4 64 65 .text 66.Ltext0: 67 .globl SYMBOL(main) 68 .type SYMBOL(main), %function 69SYMBOL(main): 70.LFB0: 71 .4byte 0 72.LFE0: 73 .size SYMBOL(main), .-SYMBOL(main) 74.Letext0: 75 76 .section .debug_types,"",%progbits 77.Ldebug_types0: 78 .4byte .Ltu_end - .Ltu_start /* Length of Compilation Unit Info */ 79.Ltu_start: 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 */ 84 .byte 0x8b 85 .byte 0x7e 86 .byte 0xac 87 .byte 0xce 88 .byte 0xf1 89 .byte 0x22 90 .byte 0x90 91 .4byte .Ltu_class_type - .Ldebug_types0 /* Offset to Type DIE */ 92 .uleb128 0x1 /* (DIE (0x17) DW_TAG_type_unit) */ 93 .byte 0x4 /* DW_AT_language */ 94 .byte 0x73 /* DW_AT_GNU_odr_signature */ 95 .byte 0xea 96 .byte 0x85 97 .byte 0x23 98 .byte 0x75 99 .byte 0x8a 100 .byte 0x7e 101 .byte 0x87 102 .4byte .Ldebug_line0 /* DW_AT_stmt_list */ 103 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 */ 109 110.Ltu_class_type: 111 .uleb128 0x2 /* (DIE (0x25) 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 0x3f /* DW_AT_sibling */ 117 .uleb128 0x3 /* (DIE (0x31) DW_TAG_member) */ 118 .ascii "bar\0" /* DW_AT_name */ 119 .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ 120 .byte 0x4 /* DW_AT_decl_line */ 121 .4byte 0x3f /* DW_AT_type */ 122 .byte 0 /* DW_AT_data_member_location */ 123 .byte 0x1 /* DW_AT_accessibility */ 124 .byte 0 /* end of children of DIE 0x25 */ 125 .uleb128 0x4 /* (DIE (0x3f) DW_TAG_base_type) */ 126 .byte 0x4 /* DW_AT_byte_size */ 127 .byte 0x5 /* DW_AT_encoding */ 128 .ascii "int\0" /* DW_AT_name */ 129 .byte 0 /* end of children of DIE 0x17 */ 130 131.Ltu_end: 132 133 .section .debug_info,"",%progbits 134.Ldebug_info0: 135 .4byte .Lcu_end - .Lcu_start /* Length of Compilation Unit Info */ 136.Lcu_start: 137 .2byte 0x4 /* DWARF version number */ 138 .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */ 139 .byte 0x4 /* Pointer Size (in bytes) */ 140 .uleb128 0x5 /* (DIE (0xb) DW_TAG_compile_unit) */ 141 .4byte .LASF0 /* DW_AT_producer: "GNU C++ 4.6.3 20120306" */ 142 .byte 0x4 /* DW_AT_language */ 143 .4byte .LASF1 /* DW_AT_name: "pr13961.cc" */ 144 .4byte .LASF2 /* DW_AT_comp_dir: "." */ 145 .4byte .Ltext0 /* DW_AT_low_pc */ 146 .4byte .Letext0 /* DW_AT_high_pc */ 147 .4byte .Ldebug_line0 /* DW_AT_stmt_list */ 148.Lint_base_type: 149 .uleb128 0x4 /* (DIE (0x25) DW_TAG_base_type) */ 150 .byte 0x4 /* DW_AT_byte_size */ 151 .byte 0x5 /* DW_AT_encoding */ 152 .ascii "int\0" /* DW_AT_name */ 153 .uleb128 0x6 /* (DIE (0x2c) DW_TAG_subprogram) */ 154 /* DW_AT_external */ 155 .4byte .LASF3 /* DW_AT_name: "main" */ 156 .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ 157 .byte 0xa /* DW_AT_decl_line */ 158 .4byte 0x25 /* DW_AT_type */ 159 .4byte .LFB0 /* DW_AT_low_pc */ 160 .4byte .LFE0 /* DW_AT_high_pc */ 161 .uleb128 0x1 /* DW_AT_frame_base */ 162 .byte 0x9c /* DW_OP_call_frame_cfa */ 163 /* DW_AT_GNU_all_call_sites */ 164 .uleb128 0x7 /* (DIE (0x41) DW_TAG_variable) */ 165 .ascii "baz\0" /* DW_AT_name */ 166 .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ 167 .byte 0x7 /* DW_AT_decl_line */ 168 .byte 0x19 /* DW_AT_type */ 169 .byte 0x8b 170 .byte 0x7e 171 .byte 0xac 172 .byte 0xce 173 .byte 0xf1 174 .byte 0x22 175 .byte 0x90 176 /* DW_AT_external */ 177 .uleb128 0x5 /* DW_AT_location */ 178 .byte 0x3 /* DW_OP_addr */ 179 .4byte baz 180 181 /* Manually inserted to have a DW_AT_specification refering to 182 something and appearing ahead of it. */ 183 .uleb128 0x8 /* DW_TAG_class_type */ 184 .4byte .Lcu_class_type - .Ldebug_info0 /* DW_AT_specification */ 185 186.Lcu_int_type: 187 .uleb128 0x4 /* (DIE (0x3f) DW_TAG_base_type) */ 188 .byte 0x4 /* DW_AT_byte_size */ 189 .byte 0x5 /* DW_AT_encoding */ 190 .ascii "int\0" /* DW_AT_name */ 191.Lcu_class_type: 192 .uleb128 0x2 /* (DIE (0x25) DW_TAG_class_type) */ 193 .ascii "foo2\0" /* DW_AT_name */ 194 .byte 0x4 /* DW_AT_byte_size */ 195 .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ 196 .byte 0x1 /* DW_AT_decl_line */ 197 .4byte 0x3f /* DW_AT_sibling */ 198 .uleb128 0x3 /* (DIE (0x31) DW_TAG_member) */ 199 .ascii "bar\0" /* DW_AT_name */ 200 .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ 201 .byte 0x4 /* DW_AT_decl_line */ 202 .4byte .Lcu_int_type - .Ldebug_info0 /* DW_AT_type */ 203 .byte 0 /* DW_AT_data_member_location */ 204 .byte 0x1 /* DW_AT_accessibility */ 205 .byte 0 /* end of children of DIE 0x25 */ 206 .uleb128 0x4 /* (DIE (0x3f) DW_TAG_base_type) */ 207 .byte 0x4 /* DW_AT_byte_size */ 208 .byte 0x5 /* DW_AT_encoding */ 209 .ascii "int\0" /* DW_AT_name */ 210 .byte 0 /* end of children of DIE 0x17 */ 211 /* End of manual insertion */ 212 213 .byte 0 /* end of children of DIE 0xb */ 214 215.Lcu_end: 216 217 .section .debug_abbrev,"",%progbits 218.Ldebug_abbrev0: 219 .uleb128 0x1 /* (abbrev code) */ 220 .uleb128 0x41 /* (TAG: DW_TAG_type_unit) */ 221 .byte 0x1 /* DW_children_yes */ 222 .uleb128 0x13 /* (DW_AT_language) */ 223 .uleb128 0xb /* (DW_FORM_data1) */ 224 .uleb128 0x210f /* (DW_AT_GNU_odr_signature) */ 225 .uleb128 0x7 /* (DW_FORM_data8) */ 226 .uleb128 0x10 /* (DW_AT_stmt_list) */ 227 .uleb128 0x17 /* (DW_FORM_sec_offset) */ 228 .byte 0 229 .byte 0 230 .uleb128 0x2 /* (abbrev code) */ 231 .uleb128 0x2 /* (TAG: DW_TAG_class_type) */ 232 .byte 0x1 /* DW_children_yes */ 233 .uleb128 0x3 /* (DW_AT_name) */ 234 .uleb128 0x8 /* (DW_FORM_string) */ 235 .uleb128 0xb /* (DW_AT_byte_size) */ 236 .uleb128 0xb /* (DW_FORM_data1) */ 237 .uleb128 0x3a /* (DW_AT_decl_file) */ 238 .uleb128 0xb /* (DW_FORM_data1) */ 239 .uleb128 0x3b /* (DW_AT_decl_line) */ 240 .uleb128 0xb /* (DW_FORM_data1) */ 241 .uleb128 0x1 /* (DW_AT_sibling) */ 242 .uleb128 0x13 /* (DW_FORM_ref4) */ 243 .byte 0 244 .byte 0 245 .uleb128 0x3 /* (abbrev code) */ 246 .uleb128 0xd /* (TAG: DW_TAG_member) */ 247 .byte 0 /* DW_children_no */ 248 .uleb128 0x3 /* (DW_AT_name) */ 249 .uleb128 0x8 /* (DW_FORM_string) */ 250 .uleb128 0x3a /* (DW_AT_decl_file) */ 251 .uleb128 0xb /* (DW_FORM_data1) */ 252 .uleb128 0x3b /* (DW_AT_decl_line) */ 253 .uleb128 0xb /* (DW_FORM_data1) */ 254 .uleb128 0x49 /* (DW_AT_type) */ 255 .uleb128 0x13 /* (DW_FORM_ref4) */ 256 .uleb128 0x38 /* (DW_AT_data_member_location) */ 257 .uleb128 0xb /* (DW_FORM_data1) */ 258 .uleb128 0x32 /* (DW_AT_accessibility) */ 259 .uleb128 0xb /* (DW_FORM_data1) */ 260 .byte 0 261 .byte 0 262 .uleb128 0x4 /* (abbrev code) */ 263 .uleb128 0x24 /* (TAG: DW_TAG_base_type) */ 264 .byte 0 /* DW_children_no */ 265 .uleb128 0xb /* (DW_AT_byte_size) */ 266 .uleb128 0xb /* (DW_FORM_data1) */ 267 .uleb128 0x3e /* (DW_AT_encoding) */ 268 .uleb128 0xb /* (DW_FORM_data1) */ 269 .uleb128 0x3 /* (DW_AT_name) */ 270 .uleb128 0x8 /* (DW_FORM_string) */ 271 .byte 0 272 .byte 0 273 .uleb128 0x5 /* (abbrev code) */ 274 .uleb128 0x11 /* (TAG: DW_TAG_compile_unit) */ 275 .byte 0x1 /* DW_children_yes */ 276 .uleb128 0x25 /* (DW_AT_producer) */ 277 .uleb128 0xe /* (DW_FORM_strp) */ 278 .uleb128 0x13 /* (DW_AT_language) */ 279 .uleb128 0xb /* (DW_FORM_data1) */ 280 .uleb128 0x3 /* (DW_AT_name) */ 281 .uleb128 0xe /* (DW_FORM_strp) */ 282 .uleb128 0x1b /* (DW_AT_comp_dir) */ 283 .uleb128 0xe /* (DW_FORM_strp) */ 284 .uleb128 0x11 /* (DW_AT_low_pc) */ 285 .uleb128 0x1 /* (DW_FORM_addr) */ 286 .uleb128 0x12 /* (DW_AT_high_pc) */ 287 .uleb128 0x1 /* (DW_FORM_addr) */ 288 .uleb128 0x10 /* (DW_AT_stmt_list) */ 289 .uleb128 0x17 /* (DW_FORM_sec_offset) */ 290 .byte 0 291 .byte 0 292 .uleb128 0x6 /* (abbrev code) */ 293 .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */ 294 .byte 0 /* DW_children_no */ 295 .uleb128 0x3f /* (DW_AT_external) */ 296 .uleb128 0x19 /* (DW_FORM_flag_present) */ 297 .uleb128 0x3 /* (DW_AT_name) */ 298 .uleb128 0xe /* (DW_FORM_strp) */ 299 .uleb128 0x3a /* (DW_AT_decl_file) */ 300 .uleb128 0xb /* (DW_FORM_data1) */ 301 .uleb128 0x3b /* (DW_AT_decl_line) */ 302 .uleb128 0xb /* (DW_FORM_data1) */ 303 .uleb128 0x49 /* (DW_AT_type) */ 304 .uleb128 0x13 /* (DW_FORM_ref4) */ 305 .uleb128 0x11 /* (DW_AT_low_pc) */ 306 .uleb128 0x1 /* (DW_FORM_addr) */ 307 .uleb128 0x12 /* (DW_AT_high_pc) */ 308 .uleb128 0x1 /* (DW_FORM_addr) */ 309 .uleb128 0x40 /* (DW_AT_frame_base) */ 310 .uleb128 0x18 /* (DW_FORM_exprloc) */ 311 .uleb128 0x2117 /* (DW_AT_GNU_all_call_sites) */ 312 .uleb128 0x19 /* (DW_FORM_flag_present) */ 313 .byte 0 314 .byte 0 315 .uleb128 0x7 /* (abbrev code) */ 316 .uleb128 0x34 /* (TAG: DW_TAG_variable) */ 317 .byte 0 /* DW_children_no */ 318 .uleb128 0x3 /* (DW_AT_name) */ 319 .uleb128 0x8 /* (DW_FORM_string) */ 320 .uleb128 0x3a /* (DW_AT_decl_file) */ 321 .uleb128 0xb /* (DW_FORM_data1) */ 322 .uleb128 0x3b /* (DW_AT_decl_line) */ 323 .uleb128 0xb /* (DW_FORM_data1) */ 324 .uleb128 0x49 /* (DW_AT_type) */ 325 .uleb128 0x20 /* (DW_FORM_ref_sig8) */ 326 .uleb128 0x3f /* (DW_AT_external) */ 327 .uleb128 0x19 /* (DW_FORM_flag_present) */ 328 .uleb128 0x2 /* (DW_AT_location) */ 329 .uleb128 0x18 /* (DW_FORM_exprloc) */ 330 .byte 0 331 .byte 0 332 333 /* Manually inserted. */ 334 .uleb128 0x8 /* abbrev code */ 335 .uleb128 0x2 /* DW_TAG_class_type */ 336 .byte 0x0 /* DW_has_children_no */ 337 .uleb128 0x47 /* DW_AT_specification */ 338 .uleb128 0x13 /* DW_FORM_ref4 */ 339 .byte 0x0 /* Terminator */ 340 .byte 0x0 /* Terminator */ 341 /* End of manual insertion. */ 342 343 .byte 0 344 345 .section .debug_aranges,"",%progbits 346 .4byte 0x1c /* Length of Address Ranges Info */ 347 .2byte 0x2 /* DWARF Version */ 348 .4byte .Ldebug_info0 /* Offset of Compilation Unit Info */ 349 .byte 0x4 /* Size of Address */ 350 .byte 0 /* Size of Segment Descriptor */ 351 .2byte 0 /* Pad to 8 byte boundary */ 352 .2byte 0 353 .4byte .Ltext0 /* Address */ 354 .4byte .Letext0-.Ltext0 /* Length */ 355 .4byte 0 356 .4byte 0 357 358 .section .debug_line,"",%progbits 359.Ldebug_line0: 360 361 .section .debug_str,"MS",%progbits,1 362.LASF0: 363 .string "GNU C++ 4.6.3 20120306" 364.LASF2: 365 .string "." 366.LASF1: 367 .string "pr13961.cc" 368.LASF3: 369 .string "main" 370 371