[Bug symtab/32680] Interpretation of DW_FORM_data*
tromey at sourceware dot org
sourceware-bugzilla@sourceware.org
Fri May 22 15:28:31 GMT 2026
https://sourceware.org/bugzilla/show_bug.cgi?id=32680
--- Comment #24 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Sourceware Commits from comment #23)
> A user pointed out a problem when printing certain values from an Ada
> enumeration type. Investigation showed that the problem was that some
> enumeration constants were emitted using DW_FORM_data1, and were
> incorrectly sign-extended by gdb.
BTW during the review:
https://sourceware.org/pipermail/gdb-patches/2026-May/227463.html
Andrew discovered that this test case used to work without this extension.
gdb could use the DWARF form of the various constants emitted for the enum
to determine the sign. E.g if a constant uses DW_FORM_sdata, then it is
a signed enum.
This looks like a mild pain to implement properly in that we'd have to
first see if any "definitely signed" constants exist before knowing how
to interpret any other ones. That is, consider an enum where the last
value uses DW_FORM_sdata and all the earlier ones use the ambiguous
DW_FORM_data1.
It's unclear to me if we should even bother with this though because a compiler
can always just emit a base type for the enum and avoid any ambiguity.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Gdb-prs
mailing list