[llvm-bugs] [Bug 42910] New: Make dwarf assembly output more symbolic == editable

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 7 00:29:00 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42910

            Bug ID: 42910
           Summary: Make dwarf assembly output more symbolic == editable
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: labath at google.com
                CC: llvm-bugs at lists.llvm.org, rnk at google.com

Currently, we go out of our way to print all constants in the dwarf we emit as
literal constants. This probably speeds up codegen, but it probably hurts the
readability, and definitely hurts editability (e.g., for producing test cases
with "weird" dwarf for lldb or other tools) of the generated dwarf. Here's a
non-exhaustive list of things we could do (probably guarded by -fverbose-asm)
to improve this. It's roughly ordered according to the impact I estimate the
changes would have on the readability/editability of the generated dwarf:

- make all DIE cross-references in the debug_info section symbolic (e.g. from a
variable DIE to it's type). Currently, we just emit these as integral
constants, which is a problem, because pretty much any change to the debug info
will upset these offsets. However, if these were emitted as something like
```
        .byte   2                       # Abbrev [2] 0x1e:0x15 DW_TAG_variable
        .long   .Ltype47-.Lcu_start     # DW_AT_type
        ...
.Ltype47:
        .byte   3                       # Abbrev [3] 0x33:0x7 DW_TAG_base_type
        ...
```
then one could freely add/remove dies or attributes and the references would
remain valid.

- make references from debug_info -> debug_abbrev symbolic. When adding or
removing an attribute, one needs to make coordinated changes in the the
abbreviation as well as in all DIEs that reference that abbreviation. This
would make it easier to find all of them and jump between them. This could look
something like:
.section .debug_abbrev
.set .Labbrev_DW_TAG_variable0, 0
  .byte .Labbrev_DW_TAG_variable0
  ...

.section .debug_info
  .uleb128 .Labbrev_DW_TAG_variable0

- make all DWARF5 indexed section references (debug_str_offsets, etc.)
symbolic. Ironically, these were introduced precisely to reduce the overhead of
symbolic references in previous dwarf versions. However, they do make it hard
to figure out what a particular (e.g.) DW_AT_name refers to as they show up as
just a ".byte". This could work in a manner similar to .debug_abbrev above, but
it is a lower priority because DWARF5 can be turned off. :)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190807/de722678/attachment-0001.html>


More information about the llvm-bugs mailing list