diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2023-03-23 00:15:17 +0000 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2023-03-24 13:37:32 +0000 |
commit | 3672e3262210d1a08a3fdc44569ea8b5696c43cc (patch) | |
tree | c943257469b7e0a989a265e32089319fd9e75254 /libctf/ctf-types.c | |
parent | 04d91c807eaf4395472409a53e2acd9ad89683f0 (diff) | |
download | gdb-3672e3262210d1a08a3fdc44569ea8b5696c43cc.zip gdb-3672e3262210d1a08a3fdc44569ea8b5696c43cc.tar.gz gdb-3672e3262210d1a08a3fdc44569ea8b5696c43cc.tar.bz2 |
libctf: get the offsets of fields of unnamed structs/unions right
We were failing to add the offsets of the containing struct/union
in this case, leading to all offsets being relative to the unnamed
struct/union itself.
libctf/
PR libctf/30264
* ctf-types.c (ctf_member_info): Add the offset of the unnamed
member of the current struct as necessary.
* testsuite/libctf-lookup/unnamed-field-info*: New test.
Diffstat (limited to 'libctf/ctf-types.c')
-rw-r--r-- | libctf/ctf-types.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libctf/ctf-types.c b/libctf/ctf-types.c index d21f6d5..dd82053 100644 --- a/libctf/ctf-types.c +++ b/libctf/ctf-types.c @@ -1417,7 +1417,10 @@ ctf_member_info (ctf_dict_t *fp, ctf_id_t type, const char *name, && (ctf_type_kind (fp, memb.ctlm_type) == CTF_K_STRUCT || ctf_type_kind (fp, memb.ctlm_type) == CTF_K_UNION) && (ctf_member_info (fp, memb.ctlm_type, name, mip) == 0)) - return 0; + { + mip->ctm_offset += (unsigned long) CTF_LMEM_OFFSET (&memb); + return 0; + } if (strcmp (membname, name) == 0) { |