[RFA 1/3] Initial support for variant parts
Joel Brobecker
brobecker@adacore.com
Thu Feb 22 03:47:00 GMT 2018
> Joel> Another note for the future: Discriminants in Ada can be any discrete
> Joel> type (integers, signed or unsigned, enum, etc) or even an access type
> Joel> (the equivalent of a pointer in C). Thinking of the future, I think we
> Joel> would change the ULONGEST here into an array of char * containing the
> Joel> target-side representation of the dicriminant. Or would you suggest
> Joel> something different?
>
> My first thought is that using the target representation is inconvenient
> in the DWARF reader, because with DW_AT_discr_* we just get scalar
> values.
> It seems to me that using a wide-enough scalar here would be enough for
> all the cases you list, provided that sign extension was handled
> properly. I'm not 100% sure this does handle sign extension though -- I
> can update the test for that.
Yeah. I re-read the DWARF 5 standard, and indeed, I agree.
(and thanks for cathing a latent bug elsewhere ;-)).
For people like me, a small comment explaining that signed discriminant
values are also handled despite the use of an unsigned type thanks to
proper sign extension might avoid some confusion. Would it be OK to
add something like this?
Thanks Tom!
--
Joel
More information about the Gdb-patches
mailing list