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