Update DWARF for space optimizations #46173
Labels
A-debuginfo
Area: Debugging information in compiled programs (DWARF, PDB, etc.)
C-bug
Category: This is a bug.
#45225 implemented a number of space optimizations. However, the DWARF was not updated to follow.
For example, for a sample type mentioned in the PR:
Nightly emits this DWARF:
This is entirely missing entries for
C
andD
(B
is implicit in the specialRUST$ENCODED$ENUM$0$B
member name).This is a good opportunity to remove
RUST$ENCODED$ENUM
and alsoRUST$ENUM$DISR
.@eddyb pointed out one approach on irc, namely to use the existing
DW_TAG_variant_part
support in DWARF. This will yield somewhat weird-looking output; first because the tag is only defined as a child of a structure, so the union will have to be wrapped in an artificial struct; and second because the discriminant is defined to be a reference to one of the struct's members.This does seem likely to work, though; and since neither gdb nor lldb currently handle
DW_TAG_variant_part
at all, we probably have some leeway to do what we like. Plan B might be something like introduce a small DWARF extension to represent the layout in a form closer to what rustc is actually doing.Unfortunately LLVM's debuginfo builder also does not seem to have a notion of discriminated unions, so step 1 will have to be an LLVM patch.
The text was updated successfully, but these errors were encountered: