[llvm-bugs] [Bug 44213] New: DW_AT_LLVM_isysroot isn't useful

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 3 13:07:55 PST 2019


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

            Bug ID: 44213
           Summary: DW_AT_LLVM_isysroot isn't useful
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: aprantl at apple.com
                CC: jdevlieghere at apple.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

Currently an imported Clang module is represented in DWARF as

  DW_TAG_module
    ... other atributes ...
    DW_AT_LLVM_isysroot ("/Applications/Xcode.app/.../MacOSX10.15.sdk")

While the sysroot is one of the factors necessary to import a
module in the debugger, in its current form this isn't
particularly useful. First, the sysroot is a property of the
compile unit, not the module, so storing it in all DW_TAG_module DIEs
is redundant. Further, like the resource directory, it will often
be in a different location on the machine where the debugger is
compared to the machine the program was built with. We could work
around this problem by using -fdebug-prefix-map, but I think I
have an even more elegant solution:

To make it more useful, I'm proposing to

1. move DW_AT_LLVM_isysroot to DW_TAG_compile_unit and

2. on Darwin, augment it with a new attribute
   DW_AT_LLVM_sdk ("MacOSX10.15.sdk")

3. rename DW_AT_LLVM_isysroot to DW_AT_LLVM_sysroot
   (the "i" is an artifact of the command line interface)

4. Use -fdebug-prefix-map to replace all occurrences of the
   sysroot and resource directory with a placeholder,
   e.g., "$CLANG_SYSROOT" and "$CLANG_RESOURCEDIR". Perhaps this
   can even be on by default.

This will allow LLDB to find a matching SDK on the machine it
runs on without hardcoding a path to it.

After these steps, the debug info will look like:

  DW_TAG_compile_unit
    ... other atributes ...
    DW_AT_LLVM_sdk ("MacOSX10.15.sdk")
    DW_AT_LLVM_sysroot ("${CLANG_SYSROOT}")

    DW_TAG_module
      ... other atributes ...
      DW_AT_name ("Darwin")
      DW_AT_LLVM_include_path ("${CLANG_SYSROOT}/usr/include")

which will make both remote debuggers and people interested in reproducible
builds happy.

-- 
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/20191203/b0e51f82/attachment.html>


More information about the llvm-bugs mailing list