1 1.1 christos /* This testcase is part of GDB, the GNU debugger. 2 1.1 christos 3 1.11 christos Copyright 2010-2024 Free Software Foundation, Inc. 4 1.1 christos 5 1.1 christos This program is free software; you can redistribute it and/or modify 6 1.1 christos it under the terms of the GNU General Public License as published by 7 1.1 christos the Free Software Foundation; either version 3 of the License, or 8 1.1 christos (at your option) any later version. 9 1.1 christos 10 1.1 christos This program is distributed in the hope that it will be useful, 11 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of 12 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 1.1 christos GNU General Public License for more details. 14 1.1 christos 15 1.1 christos You should have received a copy of the GNU General Public License 16 1.1 christos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 17 1.1 christos 18 1.1 christos /* The goal of this test is to provide anonymous DW_TAG_structure_type 19 1.1 christos containing __pfn + __delta (read in by quirk_gcc_member_function_pointer) 20 1.1 christos before DW_TAG_structure_type of "class C" to exploit the forward reference 21 1.1 christos through "__pfn" and back from DW_TAG_member "fp" of "class C". As the 22 1.1 christos compiler may place the DIEs in arbitrary order they are rather prepared as 23 1.1 christos a .S file. 24 1.1 christos 25 1.1 christos class C; 26 1.1 christos typedef int (C::*fp_t) (); 27 1.1 christos fp_t fp; 28 1.1 christos class C 29 1.1 christos { 30 1.1 christos int (C::*fp) (); 31 1.1 christos } c; */ 32 1.1 christos 33 1.1 christos .file "member-ptr-forwardref.cc" 34 1.1 christos .section .debug_abbrev,"",%progbits 35 1.1 christos .Ldebug_abbrev0: 36 1.1 christos .section .debug_info,"",%progbits 37 1.1 christos .Ldebug_info0: 38 1.1 christos .section .debug_line,"",%progbits 39 1.1 christos .Ldebug_line0: 40 1.1 christos .text 41 1.1 christos .Ltext0: 42 1.1 christos .globl fp 43 1.1 christos .data 44 1.1 christos .align 4 45 1.1 christos .type fp, %object 46 1.1 christos .size fp, 8 47 1.1 christos fp: 48 1.1 christos .zero 8 49 1.1 christos .globl c 50 1.1 christos .align 4 51 1.1 christos .type c, %object 52 1.1 christos .size c, 8 53 1.1 christos c: 54 1.1 christos .zero 8 55 1.1 christos .text 56 1.1 christos .Letext0: 57 1.1 christos .file 1 "gdb.dwarf2/member-ptr-forwardref.cc" 58 1.1 christos .section .debug_info 59 1.1 christos .4byte 0xa9 /* Length of Compilation Unit Info */ 60 1.1 christos .2byte 0x3 /* DWARF version number */ 61 1.1 christos .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */ 62 1.1 christos .byte 0x4 /* Pointer Size (in bytes) */ 63 1.1 christos .uleb128 0x1 /* (DIE (0xb) DW_TAG_compile_unit) */ 64 1.1 christos .4byte .LASF2 /* DW_AT_producer: "GNU C++ 4.4.2 20091222 (Red Hat 4.4.2-20)" */ 65 1.1 christos .byte 0x4 /* DW_AT_language */ 66 1.1 christos .4byte .LASF3 /* DW_AT_name: "gdb.dwarf2/member-ptr-forwardref.cc" */ 67 1.1 christos .4byte .LASF4 /* DW_AT_comp_dir: "gdb/testsuite" */ 68 1.1 christos .4byte .Ltext0 /* DW_AT_low_pc */ 69 1.1 christos .4byte .Letext0 /* DW_AT_high_pc */ 70 1.1 christos .4byte .Ldebug_line0 /* DW_AT_stmt_list */ 71 1.1 christos .uleb128 0x2 /* (DIE (0x25) DW_TAG_typedef) */ 72 1.1 christos .4byte .LASF5 /* DW_AT_name: "fp_t" */ 73 1.1 christos .byte 0x1 /* DW_AT_decl_file (gdb.dwarf2/member-ptr-forwardref.cc) */ 74 1.1 christos .byte 0x13 /* DW_AT_decl_line */ 75 1.1 christos .4byte 0x30 /* DW_AT_type */ 76 1.1 christos .uleb128 0x3 /* (DIE (0x30) DW_TAG_structure_type) */ 77 1.1 christos .byte 0x8 /* DW_AT_byte_size */ 78 1.1 christos .byte 0x1 /* DW_AT_decl_file (gdb.dwarf2/member-ptr-forwardref.cc) */ 79 1.1 christos .byte 0x13 /* DW_AT_decl_line */ 80 1.1 christos .4byte 0x51 /* DW_AT_sibling */ 81 1.1 christos .uleb128 0x4 /* (DIE (0x38) DW_TAG_member) */ 82 1.1 christos .4byte .LASF0 /* DW_AT_name: "__pfn" */ 83 1.1 christos .byte 0x1 /* DW_AT_decl_file (gdb.dwarf2/member-ptr-forwardref.cc) */ 84 1.1 christos .byte 0x13 /* DW_AT_decl_line */ 85 1.1 christos .4byte 0x85 /* DW_AT_type */ 86 1.1 christos .sleb128 0 /* DW_AT_data_member_location */ 87 1.1 christos .uleb128 0x4 /* (DIE (0x44) DW_TAG_member) */ 88 1.1 christos .4byte .LASF1 /* DW_AT_name: "__delta" */ 89 1.1 christos .byte 0x1 /* DW_AT_decl_file (gdb.dwarf2/member-ptr-forwardref.cc) */ 90 1.1 christos .byte 0x13 /* DW_AT_decl_line */ 91 1.1 christos .4byte 0x61 /* DW_AT_type */ 92 1.1 christos .sleb128 4 /* DW_AT_data_member_location */ 93 1.1 christos .byte 0x0 /* end of children of DIE 0x30 */ 94 1.1 christos .uleb128 0x5 /* (DIE (0x51) DW_TAG_subroutine_type) */ 95 1.1 christos .4byte 0x61 /* DW_AT_type */ 96 1.1 christos .4byte 0x61 /* DW_AT_sibling */ 97 1.1 christos .uleb128 0x6 /* (DIE (0x5a) DW_TAG_formal_parameter) */ 98 1.1 christos .4byte 0x68 /* DW_AT_type */ 99 1.1 christos .byte 0x1 /* DW_AT_artificial */ 100 1.1 christos .byte 0x0 /* end of children of DIE 0x51 */ 101 1.1 christos .uleb128 0x7 /* (DIE (0x61) DW_TAG_base_type) */ 102 1.1 christos .byte 0x4 /* DW_AT_byte_size */ 103 1.1 christos .byte 0x5 /* DW_AT_encoding */ 104 1.1 christos .ascii "int\0" /* DW_AT_name */ 105 1.1 christos .uleb128 0x8 /* (DIE (0x68) DW_TAG_pointer_type) */ 106 1.1 christos .byte 0x4 /* DW_AT_byte_size */ 107 1.1 christos .4byte 0x6e /* DW_AT_type */ 108 1.1 christos .uleb128 0x9 /* (DIE (0x6e) DW_TAG_structure_type) */ 109 1.1 christos .ascii "C\0" /* DW_AT_name */ 110 1.1 christos .byte 0x8 /* DW_AT_byte_size */ 111 1.1 christos .byte 0x1 /* DW_AT_decl_file (gdb.dwarf2/member-ptr-forwardref.cc) */ 112 1.1 christos .byte 0x16 /* DW_AT_decl_line */ 113 1.1 christos .4byte 0x85 /* DW_AT_sibling */ 114 1.1 christos .uleb128 0xa /* (DIE (0x78) DW_TAG_member) */ 115 1.1 christos .ascii "fp\0" /* DW_AT_name */ 116 1.1 christos .byte 0x1 /* DW_AT_decl_file (gdb.dwarf2/member-ptr-forwardref.cc) */ 117 1.1 christos .byte 0x17 /* DW_AT_decl_line */ 118 1.1 christos .4byte 0x30 /* DW_AT_type */ 119 1.1 christos .sleb128 0 /* DW_AT_data_member_location */ 120 1.1 christos .byte 0x3 /* DW_AT_accessibility */ 121 1.1 christos .byte 0x0 /* end of children of DIE 0x6e */ 122 1.1 christos .uleb128 0x8 /* (DIE (0x85) DW_TAG_pointer_type) */ 123 1.1 christos .byte 0x4 /* DW_AT_byte_size */ 124 1.1 christos .4byte 0x51 /* DW_AT_type */ 125 1.1 christos .uleb128 0xb /* (DIE (0x8b) DW_TAG_variable) */ 126 1.1 christos .ascii "fp\0" /* DW_AT_name */ 127 1.1 christos .byte 0x1 /* DW_AT_decl_file (gdb.dwarf2/member-ptr-forwardref.cc) */ 128 1.1 christos .byte 0x14 /* DW_AT_decl_line */ 129 1.1 christos .4byte 0x25 /* DW_AT_type */ 130 1.1 christos .byte 0x1 /* DW_AT_external */ 131 1.1 christos .byte 0x5 /* DW_AT_location */ 132 1.1 christos .byte 0x3 /* DW_OP_addr */ 133 1.1 christos .4byte fp 134 1.1 christos .uleb128 0xb /* (DIE (0x9c) DW_TAG_variable) */ 135 1.1 christos .ascii "c\0" /* DW_AT_name */ 136 1.1 christos .byte 0x1 /* DW_AT_decl_file (gdb.dwarf2/member-ptr-forwardref.cc) */ 137 1.1 christos .byte 0x18 /* DW_AT_decl_line */ 138 1.1 christos .4byte 0x6e /* DW_AT_type */ 139 1.1 christos .byte 0x1 /* DW_AT_external */ 140 1.1 christos .byte 0x5 /* DW_AT_location */ 141 1.1 christos .byte 0x3 /* DW_OP_addr */ 142 1.1 christos .4byte c 143 1.1 christos .byte 0x0 /* end of children of DIE 0xb */ 144 1.1 christos .section .debug_abbrev 145 1.1 christos .uleb128 0x1 /* (abbrev code) */ 146 1.1 christos .uleb128 0x11 /* (TAG: DW_TAG_compile_unit) */ 147 1.1 christos .byte 0x1 /* DW_children_yes */ 148 1.1 christos .uleb128 0x25 /* (DW_AT_producer) */ 149 1.1 christos .uleb128 0xe /* (DW_FORM_strp) */ 150 1.1 christos .uleb128 0x13 /* (DW_AT_language) */ 151 1.1 christos .uleb128 0xb /* (DW_FORM_data1) */ 152 1.1 christos .uleb128 0x3 /* (DW_AT_name) */ 153 1.1 christos .uleb128 0xe /* (DW_FORM_strp) */ 154 1.1 christos .uleb128 0x1b /* (DW_AT_comp_dir) */ 155 1.1 christos .uleb128 0xe /* (DW_FORM_strp) */ 156 1.1 christos .uleb128 0x11 /* (DW_AT_low_pc) */ 157 1.1 christos .uleb128 0x1 /* (DW_FORM_addr) */ 158 1.1 christos .uleb128 0x12 /* (DW_AT_high_pc) */ 159 1.1 christos .uleb128 0x1 /* (DW_FORM_addr) */ 160 1.1 christos .uleb128 0x10 /* (DW_AT_stmt_list) */ 161 1.1 christos .uleb128 0x6 /* (DW_FORM_data4) */ 162 1.1 christos .byte 0x0 163 1.1 christos .byte 0x0 164 1.1 christos .uleb128 0x2 /* (abbrev code) */ 165 1.1 christos .uleb128 0x16 /* (TAG: DW_TAG_typedef) */ 166 1.1 christos .byte 0x0 /* DW_children_no */ 167 1.1 christos .uleb128 0x3 /* (DW_AT_name) */ 168 1.1 christos .uleb128 0xe /* (DW_FORM_strp) */ 169 1.1 christos .uleb128 0x3a /* (DW_AT_decl_file) */ 170 1.1 christos .uleb128 0xb /* (DW_FORM_data1) */ 171 1.1 christos .uleb128 0x3b /* (DW_AT_decl_line) */ 172 1.1 christos .uleb128 0xb /* (DW_FORM_data1) */ 173 1.1 christos .uleb128 0x49 /* (DW_AT_type) */ 174 1.1 christos .uleb128 0x13 /* (DW_FORM_ref4) */ 175 1.1 christos .byte 0x0 176 1.1 christos .byte 0x0 177 1.1 christos .uleb128 0x3 /* (abbrev code) */ 178 1.1 christos .uleb128 0x13 /* (TAG: DW_TAG_structure_type) */ 179 1.1 christos .byte 0x1 /* DW_children_yes */ 180 1.1 christos .uleb128 0xb /* (DW_AT_byte_size) */ 181 1.1 christos .uleb128 0xb /* (DW_FORM_data1) */ 182 1.1 christos .uleb128 0x3a /* (DW_AT_decl_file) */ 183 1.1 christos .uleb128 0xb /* (DW_FORM_data1) */ 184 1.1 christos .uleb128 0x3b /* (DW_AT_decl_line) */ 185 1.1 christos .uleb128 0xb /* (DW_FORM_data1) */ 186 1.1 christos .uleb128 0x1 /* (DW_AT_sibling) */ 187 1.1 christos .uleb128 0x13 /* (DW_FORM_ref4) */ 188 1.1 christos .byte 0x0 189 1.1 christos .byte 0x0 190 1.1 christos .uleb128 0x4 /* (abbrev code) */ 191 1.1 christos .uleb128 0xd /* (TAG: DW_TAG_member) */ 192 1.1 christos .byte 0x0 /* DW_children_no */ 193 1.1 christos .uleb128 0x3 /* (DW_AT_name) */ 194 1.1 christos .uleb128 0xe /* (DW_FORM_strp) */ 195 1.1 christos .uleb128 0x3a /* (DW_AT_decl_file) */ 196 1.1 christos .uleb128 0xb /* (DW_FORM_data1) */ 197 1.1 christos .uleb128 0x3b /* (DW_AT_decl_line) */ 198 1.1 christos .uleb128 0xb /* (DW_FORM_data1) */ 199 1.1 christos .uleb128 0x49 /* (DW_AT_type) */ 200 1.1 christos .uleb128 0x13 /* (DW_FORM_ref4) */ 201 1.1 christos .uleb128 0x38 /* (DW_AT_data_member_location) */ 202 1.1 christos .uleb128 0xd /* (DW_FORM_sdata) */ 203 1.1 christos .byte 0x0 204 1.1 christos .byte 0x0 205 1.1 christos .uleb128 0x5 /* (abbrev code) */ 206 1.1 christos .uleb128 0x15 /* (TAG: DW_TAG_subroutine_type) */ 207 1.1 christos .byte 0x1 /* DW_children_yes */ 208 1.1 christos .uleb128 0x49 /* (DW_AT_type) */ 209 1.1 christos .uleb128 0x13 /* (DW_FORM_ref4) */ 210 1.1 christos .uleb128 0x1 /* (DW_AT_sibling) */ 211 1.1 christos .uleb128 0x13 /* (DW_FORM_ref4) */ 212 1.1 christos .byte 0x0 213 1.1 christos .byte 0x0 214 1.1 christos .uleb128 0x6 /* (abbrev code) */ 215 1.1 christos .uleb128 0x5 /* (TAG: DW_TAG_formal_parameter) */ 216 1.1 christos .byte 0x0 /* DW_children_no */ 217 1.1 christos .uleb128 0x49 /* (DW_AT_type) */ 218 1.1 christos .uleb128 0x13 /* (DW_FORM_ref4) */ 219 1.1 christos .uleb128 0x34 /* (DW_AT_artificial) */ 220 1.1 christos .uleb128 0xc /* (DW_FORM_flag) */ 221 1.1 christos .byte 0x0 222 1.1 christos .byte 0x0 223 1.1 christos .uleb128 0x7 /* (abbrev code) */ 224 1.1 christos .uleb128 0x24 /* (TAG: DW_TAG_base_type) */ 225 1.1 christos .byte 0x0 /* DW_children_no */ 226 1.1 christos .uleb128 0xb /* (DW_AT_byte_size) */ 227 1.1 christos .uleb128 0xb /* (DW_FORM_data1) */ 228 1.1 christos .uleb128 0x3e /* (DW_AT_encoding) */ 229 1.1 christos .uleb128 0xb /* (DW_FORM_data1) */ 230 1.1 christos .uleb128 0x3 /* (DW_AT_name) */ 231 1.1 christos .uleb128 0x8 /* (DW_FORM_string) */ 232 1.1 christos .byte 0x0 233 1.1 christos .byte 0x0 234 1.1 christos .uleb128 0x8 /* (abbrev code) */ 235 1.1 christos .uleb128 0xf /* (TAG: DW_TAG_pointer_type) */ 236 1.1 christos .byte 0x0 /* DW_children_no */ 237 1.1 christos .uleb128 0xb /* (DW_AT_byte_size) */ 238 1.1 christos .uleb128 0xb /* (DW_FORM_data1) */ 239 1.1 christos .uleb128 0x49 /* (DW_AT_type) */ 240 1.1 christos .uleb128 0x13 /* (DW_FORM_ref4) */ 241 1.1 christos .byte 0x0 242 1.1 christos .byte 0x0 243 1.1 christos .uleb128 0x9 /* (abbrev code) */ 244 1.1 christos .uleb128 0x13 /* (TAG: DW_TAG_structure_type) */ 245 1.1 christos .byte 0x1 /* DW_children_yes */ 246 1.1 christos .uleb128 0x3 /* (DW_AT_name) */ 247 1.1 christos .uleb128 0x8 /* (DW_FORM_string) */ 248 1.1 christos .uleb128 0xb /* (DW_AT_byte_size) */ 249 1.1 christos .uleb128 0xb /* (DW_FORM_data1) */ 250 1.1 christos .uleb128 0x3a /* (DW_AT_decl_file) */ 251 1.1 christos .uleb128 0xb /* (DW_FORM_data1) */ 252 1.1 christos .uleb128 0x3b /* (DW_AT_decl_line) */ 253 1.1 christos .uleb128 0xb /* (DW_FORM_data1) */ 254 1.1 christos .uleb128 0x1 /* (DW_AT_sibling) */ 255 1.1 christos .uleb128 0x13 /* (DW_FORM_ref4) */ 256 1.1 christos .byte 0x0 257 1.1 christos .byte 0x0 258 1.1 christos .uleb128 0xa /* (abbrev code) */ 259 1.1 christos .uleb128 0xd /* (TAG: DW_TAG_member) */ 260 1.1 christos .byte 0x0 /* DW_children_no */ 261 1.1 christos .uleb128 0x3 /* (DW_AT_name) */ 262 1.1 christos .uleb128 0x8 /* (DW_FORM_string) */ 263 1.1 christos .uleb128 0x3a /* (DW_AT_decl_file) */ 264 1.1 christos .uleb128 0xb /* (DW_FORM_data1) */ 265 1.1 christos .uleb128 0x3b /* (DW_AT_decl_line) */ 266 1.1 christos .uleb128 0xb /* (DW_FORM_data1) */ 267 1.1 christos .uleb128 0x49 /* (DW_AT_type) */ 268 1.1 christos .uleb128 0x13 /* (DW_FORM_ref4) */ 269 1.1 christos .uleb128 0x38 /* (DW_AT_data_member_location) */ 270 1.1 christos .uleb128 0xd /* (DW_FORM_sdata) */ 271 1.1 christos .uleb128 0x32 /* (DW_AT_accessibility) */ 272 1.1 christos .uleb128 0xb /* (DW_FORM_data1) */ 273 1.1 christos .byte 0x0 274 1.1 christos .byte 0x0 275 1.1 christos .uleb128 0xb /* (abbrev code) */ 276 1.1 christos .uleb128 0x34 /* (TAG: DW_TAG_variable) */ 277 1.1 christos .byte 0x0 /* DW_children_no */ 278 1.1 christos .uleb128 0x3 /* (DW_AT_name) */ 279 1.1 christos .uleb128 0x8 /* (DW_FORM_string) */ 280 1.1 christos .uleb128 0x3a /* (DW_AT_decl_file) */ 281 1.1 christos .uleb128 0xb /* (DW_FORM_data1) */ 282 1.1 christos .uleb128 0x3b /* (DW_AT_decl_line) */ 283 1.1 christos .uleb128 0xb /* (DW_FORM_data1) */ 284 1.1 christos .uleb128 0x49 /* (DW_AT_type) */ 285 1.1 christos .uleb128 0x13 /* (DW_FORM_ref4) */ 286 1.1 christos .uleb128 0x3f /* (DW_AT_external) */ 287 1.1 christos .uleb128 0xc /* (DW_FORM_flag) */ 288 1.1 christos .uleb128 0x2 /* (DW_AT_location) */ 289 1.1 christos .uleb128 0xa /* (DW_FORM_block1) */ 290 1.1 christos .byte 0x0 291 1.1 christos .byte 0x0 292 1.1 christos .byte 0x0 293 1.1 christos .section .debug_pubnames,"",%progbits 294 1.1 christos .4byte 0x1b /* Length of Public Names Info */ 295 1.1 christos .2byte 0x2 /* DWARF Version */ 296 1.1 christos .4byte .Ldebug_info0 /* Offset of Compilation Unit Info */ 297 1.1 christos .4byte 0xad /* Compilation Unit Length */ 298 1.1 christos .4byte 0x8b /* DIE offset */ 299 1.1 christos .ascii "fp\0" /* external name */ 300 1.1 christos .4byte 0x9c /* DIE offset */ 301 1.1 christos .ascii "c\0" /* external name */ 302 1.1 christos .4byte 0x0 303 1.1 christos .section .debug_pubtypes,"",%progbits 304 1.1 christos .4byte 0x1d /* Length of Public Type Names Info */ 305 1.1 christos .2byte 0x2 /* DWARF Version */ 306 1.1 christos .4byte .Ldebug_info0 /* Offset of Compilation Unit Info */ 307 1.1 christos .4byte 0xad /* Compilation Unit Length */ 308 1.1 christos .4byte 0x25 /* DIE offset */ 309 1.1 christos .ascii "fp_t\0" /* external name */ 310 1.1 christos .4byte 0x6e /* DIE offset */ 311 1.1 christos .ascii "C\0" /* external name */ 312 1.1 christos .4byte 0x0 313 1.1 christos .section .debug_str,"MS",%progbits,1 314 1.1 christos .LASF5: 315 1.1 christos .string "fp_t" 316 1.1 christos .LASF2: 317 1.1 christos .string "GNU C++ 4.4.2 20091222 (Red Hat 4.4.2-20)" 318 1.1 christos .LASF0: 319 1.1 christos .string "__pfn" 320 1.1 christos .LASF4: 321 1.1 christos .string "gdb/testsuite" 322 1.1 christos .LASF3: 323 1.1 christos .string "gdb.dwarf2/member-ptr-forwardref.cc" 324 1.1 christos .LASF1: 325 1.1 christos .string "__delta" 326 1.1 christos .ident "GCC: (GNU) 4.4.2 20091222 (Red Hat 4.4.2-20)" 327 1.1 christos .section .note.GNU-stack,"",%progbits 328