diff options
author | Tom Tromey <tromey@adacore.com> | 2025-10-03 10:59:29 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2025-10-07 08:25:06 -0600 |
commit | 48b5669c2e26debe49491ecf6e20e82ccf28c15b (patch) | |
tree | e81883e3483675c101c31e59e23be951cc089a61 /gdb/python/py-progspace.c | |
parent | 6d3af8c9f6805e935677757d84dd6cfdb5cda261 (diff) | |
download | binutils-48b5669c2e26debe49491ecf6e20e82ccf28c15b.zip binutils-48b5669c2e26debe49491ecf6e20e82ccf28c15b.tar.gz binutils-48b5669c2e26debe49491ecf6e20e82ccf28c15b.tar.bz2 |
Ignore artificial fields in Ada
A user found an unusual Ada situation that DWARF does not readily
support. Consider this type:
type Discrete_Typ is tagged null record;
type Int_Typ (Is_Static : Boolean) is new Discrete_Typ with null record;
type Signed_Int_Typ (Is_Static : Boolean) is
new Int_Typ (Is_Static => Is_Static)
with record
case Is_Static is
when True =>
Field : Integer;
when others =>
null;
end case;
end record;
Here, Signed_Int_Typ has a variant part where the discriminant is
stored in a superclass.
Anyway, this code caused gnat-llvm to crash. While fixing the crash,
I decided to fix this by emitting an anonymous field in Signed_Int_Typ
that represents the discriminant. This would allow member DIEs to
refer to it -- which I suppose is possibly why DWARF specified that
the discriminant should be a member of the variant (though I don't
really know; this decision always seemed very strange to me).
Making the field anonymous lead to the strange error:
Type ... is not a structure or union type.
... which comes from lookup_struct_elt, which fails when an anonymous
member of a structure has a non-composite type. This patch includes a
fix for this issue.
After fixing that, though I decided it would be better if the
artificial discriminant were still given a name. So, this patch
includes a change to ada_is_ignored_field to ignore artificial fields.
Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/python/py-progspace.c')
0 files changed, 0 insertions, 0 deletions