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.
This commit is contained in:
Nick Alcock
2023-03-23 00:15:17 +00:00
parent 04d91c807e
commit 3672e32622
4 changed files with 121 additions and 1 deletions

View File

@@ -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;