Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DWARF generation for enums #54004

Merged
merged 8 commits into from
Oct 31, 2018
Merged

Fix DWARF generation for enums #54004

merged 8 commits into from
Oct 31, 2018

Commits on Oct 30, 2018

  1. Fix DWARF generation for enums

    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
    tromey committed Oct 30, 2018
    Configuration menu
    Copy the full SHA
    71ce4c3 View commit details
    Browse the repository at this point in the history
  2. Address review comments

    This fixes the issues pointed out in review.
    tromey committed Oct 30, 2018
    Configuration menu
    Copy the full SHA
    c32f402 View commit details
    Browse the repository at this point in the history
  3. Tighten enum-debug test

    Update the new enum-debug to ensure that field "D" does not have a
    discrimnant.
    tromey committed Oct 30, 2018
    Configuration menu
    Copy the full SHA
    d8b0eb7 View commit details
    Browse the repository at this point in the history
  4. Add more enum debug info tests

    Rename the previous enum debug info test, and add more tests to cover
    c-like enums and tagged (ordinary) enums.
    tromey committed Oct 30, 2018
    Configuration menu
    Copy the full SHA
    e7c49a7 View commit details
    Browse the repository at this point in the history
  5. Avoid possible integer overflow in niche value computation

    @eddyb pointed out in review that the niche value computation had a
    possible integer overflow problem, fixed here as he suggested.
    tromey committed Oct 30, 2018
    Configuration menu
    Copy the full SHA
    da7b6b4 View commit details
    Browse the repository at this point in the history
  6. Update enum debuginfo tests

    Bug rust-lang#52452 notes some debuginfo test regressions when moving to gdb
    8.1.  This series will also cause versions of gdb before 8.2 to fail
    when a recent LLVM is used -- DW_TAG_variant_part support was not
    added until 8.2.
    
    This patch updates one of the builders to a later version of Ubuntu,
    which comes with gdb 8.2.  It updates the relevant tests to require
    both a new-enough LLVM and a new-enough gdb; the subsequent patch
    arranges to continue testing the fallback mode.
    
    The "gdbg" results are removed from these tests because the tests now
    require a rust-enabled gdb.
    
    If you read closely, you'll see that some of the lldb results in this
    patch still look a bit strange.  This will be addressed in a
    subsequent patch; I believe the fix is to disable the Python
    pretty-printers when lldb is rust-enabled.
    tromey committed Oct 30, 2018
    Configuration menu
    Copy the full SHA
    8bbb62f View commit details
    Browse the repository at this point in the history
  7. Add legacy debuginfo tests

    The enum debuginfo patch includes a legacy mode that is used when
    building against LLVM 5 and LLVM 6.  The main enum debuginfo tests
    have been updated to rely on the new approach and a new-enough gdb.
    This patch makes a copy of these tests so that the fallback mode will
    continue to be tested.
    
    Note that nil-enum.rs is not copied; it seemed not to provide enough
    value to bother.
    
    A new header directive is added, "ignore-llvm-version".  I will send a
    patch to update the rustc documentation once this lands.
    tromey committed Oct 30, 2018
    Configuration menu
    Copy the full SHA
    d36e37e View commit details
    Browse the repository at this point in the history
  8. Update lldb

    Update src/tools/lldb to pick up a needed bug fix in the
    DW_TAG_variant_part handling.
    tromey committed Oct 30, 2018
    Configuration menu
    Copy the full SHA
    98b2688 View commit details
    Browse the repository at this point in the history