diff options
author | Mark Harmstone <mark@harmstone.com> | 2024-08-26 13:58:56 +0100 |
---|---|---|
committer | Mark Harmstone <mark@harmstone.com> | 2024-08-26 16:12:52 +0100 |
commit | 91555eddd48726592478fc3fbe4a4dbce31384bf (patch) | |
tree | 6ba3974eae808ed8e174c00bbd21ef4058508261 /ld/testsuite/ld-pe | |
parent | a733b2c90463231d9fb8b143e168403d96efe54f (diff) | |
download | gdb-91555eddd48726592478fc3fbe4a4dbce31384bf.zip gdb-91555eddd48726592478fc3fbe4a4dbce31384bf.tar.gz gdb-91555eddd48726592478fc3fbe4a4dbce31384bf.tar.bz2 |
ld/PDB: handle pointers to members
If the CV_PTR_MODE_PMEM or CV_PTR_MODE_PMFUNC flags were set in an
LF_POINTER entry's attributes, there's a few extra bytes on the end that
we weren't accounting for.
Change handle_type so that we remap the containing_class field if it's
present, and add a test for this.
Diffstat (limited to 'ld/testsuite/ld-pe')
-rw-r--r-- | ld/testsuite/ld-pe/pdb-types1-typelist.d | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-pe/pdb-types1b.s | 30 | ||||
-rw-r--r-- | ld/testsuite/ld-pe/pdb.exp | 2 |
3 files changed, 33 insertions, 3 deletions
diff --git a/ld/testsuite/ld-pe/pdb-types1-typelist.d b/ld/testsuite/ld-pe/pdb-types1-typelist.d index 1caa074..e97c4f7 100644 --- a/ld/testsuite/ld-pe/pdb-types1-typelist.d +++ b/ld/testsuite/ld-pe/pdb-types1-typelist.d @@ -80,4 +80,6 @@ Contents of section .data: 04b0 65660052 656c6561 736500f1 02000312 ef.Release...... 04c0 22000515 00000000 2c100000 00000000 ".......,....... 04d0 00000000 0100656d 7074795f 73747275 ......empty_stru - 04e0 637400f1 ct.. + 04e0 637400f1 12000210 11100000 6c000100 ct..........l... + 04f0 0d100000 0500f2f1 12000210 75000000 ............u... + 0500 4c000100 0d100000 0100f2f1 L........... diff --git a/ld/testsuite/ld-pe/pdb-types1b.s b/ld/testsuite/ld-pe/pdb-types1b.s index 8bfc973..0cb301c 100644 --- a/ld/testsuite/ld-pe/pdb-types1b.s +++ b/ld/testsuite/ld-pe/pdb-types1b.s @@ -40,6 +40,12 @@ .equ CV_PTR_NEAR32, 0xa .equ CV_PTR_64, 0xc +.equ CV_PTR_MODE_PMEM, 0x40 +.equ CV_PTR_MODE_PMFUNC, 0x60 + +.equ CV_PMTYPE_D_Single, 0x01 +.equ CV_PMTYPE_F_Single, 0x05 + .section ".debug$T", "rn" .long CV_SIGNATURE_C13 @@ -614,7 +620,7 @@ /* Type 102c, empty struct */ .struct7: -.short .types_end - .struct7 - 2 +.short .ptr5 - .struct7 - 2 .short LF_STRUCTURE .short 0 /* no. members */ .short 0 /* property */ @@ -625,4 +631,26 @@ .asciz "empty_struct" /* name */ .byte 0xf1 /* padding */ +/* Type 102d, pointer to member function method2 in struct foo */ +.ptr5: +.short .ptr6 - .ptr5 - 2 +.short LF_POINTER +.long 0x1010 /* base type */ +.long (8 << 13) | CV_PTR_MODE_PMFUNC | CV_PTR_64 /* attributes */ +.long 0x100c /* containing class */ +.short CV_PMTYPE_F_Single /* member function, single inheritance */ +.byte 0xf2 /* padding */ +.byte 0xf1 /* padding */ + +/* Type 102e, pointer to member num in struct foo */ +.ptr6: +.short .types_end - .ptr6 - 2 +.short LF_POINTER +.long T_UINT4 /* base type */ +.long (8 << 13) | CV_PTR_MODE_PMEM | CV_PTR_64 /* attributes */ +.long 0x100c /* containing class */ +.short CV_PMTYPE_D_Single /* member data, single inheritance */ +.byte 0xf2 /* padding */ +.byte 0xf1 /* padding */ + .types_end: diff --git a/ld/testsuite/ld-pe/pdb.exp b/ld/testsuite/ld-pe/pdb.exp index b583e87..7ca0fb6 100644 --- a/ld/testsuite/ld-pe/pdb.exp +++ b/ld/testsuite/ld-pe/pdb.exp @@ -1036,7 +1036,7 @@ proc test5 { } { binary scan $data i end_type # end_type is one greater than the last type in the stream - if { $end_type != 0x102e } { + if { $end_type != 0x1030 } { fail "Incorrect end type value in TPI stream." } else { pass "Correct end type value in TPI stream." |