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