aboutsummaryrefslogtreecommitdiff
path: root/libctf/testsuite/libctf-lookup/unnamed-field-info-ctf.c
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2023-03-23 00:15:17 +0000
committerNick Alcock <nick.alcock@oracle.com>2023-03-24 13:37:32 +0000
commit3672e3262210d1a08a3fdc44569ea8b5696c43cc (patch)
treec943257469b7e0a989a265e32089319fd9e75254 /libctf/testsuite/libctf-lookup/unnamed-field-info-ctf.c
parent04d91c807eaf4395472409a53e2acd9ad89683f0 (diff)
downloadbinutils-3672e3262210d1a08a3fdc44569ea8b5696c43cc.zip
binutils-3672e3262210d1a08a3fdc44569ea8b5696c43cc.tar.gz
binutils-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/testsuite/libctf-lookup/unnamed-field-info-ctf.c')
-rw-r--r--libctf/testsuite/libctf-lookup/unnamed-field-info-ctf.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/libctf/testsuite/libctf-lookup/unnamed-field-info-ctf.c b/libctf/testsuite/libctf-lookup/unnamed-field-info-ctf.c
new file mode 100644
index 0000000..54d60f5
--- /dev/null
+++ b/libctf/testsuite/libctf-lookup/unnamed-field-info-ctf.c
@@ -0,0 +1,36 @@
+struct A
+{
+ int a;
+ char *b;
+ struct
+ {
+ struct
+ {
+ char *one;
+ int two;
+ };
+ union
+ {
+ char *three;
+ };
+ };
+ struct
+ {
+ int four;
+ };
+ union
+ {
+ struct
+ {
+ double x;
+ long y;
+ };
+ struct
+ {
+ struct { char *foo; } z;
+ float aleph;
+ };
+ };
+};
+
+struct A used;