This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug debug/83935] DWARF for a variant part is incorrect


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83935

--- Comment #9 from Tom Tromey <tromey at gcc dot gnu.org> ---
(In reply to Pierre-Marie de Rodat from comment #8)
> Understood, thank you for the notice! As we have to tweak the spec one way
> or another for Ada, I suggest indeed we keep the way things are implemented
> in GCC today, waiting for the DWARF committee to state on this. This will
> probably take a while, so I’m not sure what to do with this PR. ;-)

I suppose we could leave it open pending resolution.

> Can you please tell me when you managed to update GDB to work with variant?
> It could be interesting to see how it deals with GCC’s, and if it does not,
> how much work will be needed. Thank you in advance!

It is here: https://github.com/tromey/gdb/tree/variant-parts
I plan to submit it to gdb soon, like probably today.  There are 3 patches;
the first one introduces some minor changes to add discriminated unions
to gdb's type system, and the third one adds the DWARF reading parts.

I imagine there are some gaps between what I did and what Ada requires.
Since I don't know Ada I'm not really sure how big the gaps are.
I'd suggest reading it, then commenting on the gdb-patches post so that
it can be discussed there.

Dealing with the particular location of the discriminant might not be
too awful.  One simple idea would be to make a new artificial discriminant
in the discriminated union, essentially copying the member from the outer
struct.

There are two missing bits I know about: one is that I didn't need
DW_AT_discr_list, so I didn't add this.  This should be straightforward.
The other is that in Rust, a variant can only have a single member.
Multiple members could be dealt with in the current model by interposing
a new anonymous structure type, perhaps.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]