Skip to content

Commit

Permalink
Fix DWARF generation for enums
Browse files Browse the repository at this point in the history
The DWARF generated for Rust enums was always somewhat unusual.
Rather than using DWARF constructs directly, it would emit magic field
names like "RUST$ENCODED$ENUM$0$Name" and "RUST$ENUM$DISR".  Since
PR rust-lang#45225, though, even this has not worked -- the ad hoc scheme was
not updated to handle the wider variety of niche-filling layout
optimizations now available.

This patch changes the generated DWARF to use the standard tags meant
for this purpose; namely, DW_TAG_variant and DW_TAG_variant_part.

The patch to implement this went in to LLVM 7.  In order to work with
older versions of LLVM, and because LLVM doesn't do anything here for
PDB, the existing code is kept as a fallback mode.

Support for this DWARF is in the Rust lldb and in gdb 8.2.

Closes rust-lang#32920
Closes rust-lang#32924
Closes rust-lang#52762
Closes rust-lang#53153
  • Loading branch information
tromey committed Sep 21, 2018
1 parent 1002e40 commit c32ef59
Show file tree
Hide file tree
Showing 5 changed files with 494 additions and 148 deletions.
Loading

0 comments on commit c32ef59

Please sign in to comment.