[llvm-bugs] [Bug 49159] New: [DebugInfo] Malformed DWARF produced when using split dwarf

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 12 07:36:08 PST 2021


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

            Bug ID: 49159
           Summary: [DebugInfo] Malformed DWARF produced when using split
                    dwarf
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: jeremy.morse.llvm at gmail.com
                CC: dblaikie at gmail.com, llvm-bugs at lists.llvm.org,
                    paul.robinson at am.sony.com

While looking at MaskRays reproducer [0] for problems in D94976 and bug 48790,
I noticed that llvm-dwarfdump reports "invalid DIE reference (...) Offset is
between DIEs" for that reproducer too. This is present regardless of whether
D94976 is applied or whether isShareableAcrossCUs allows subprograms to be
shared across CUs. The specific problem is a DW_TAG_inlined_subroutine with an
illegal abstract origin reference:

    DW_AT_abstract_origin (0x0000002c)

llvm-dwarfdump -v says that it's a DW_FORM_ref4.

To narrow down the problem: within the reproducer metadata, look at metadata
node !1596 for the definition of "SlowLock". This has an inlined instance of
"Now" coming from node !1743, the abstract subprogram for which is created in
the skeleton unit by [1], apparently this is part of the "keep inlining
information in skeleton unit for backtracing" feature. However: because it's
not being created in a DWO unit [2], the subprogram DIE is placed in the
dwarf-file global list of abstract subprograms.

Later on, DwarfCompileUnit::constructInlinedScopeDIE [3] tries to create a
DW_TAG_inlined_subroutine site for an inlined copy of "Now" in a _different_
skeleton unit. However it picks out the abstract subprogram from the first unit
through [2], and attaches it with DW_TAG_inlined_subroutine to the DIE it's
constructing. The addDIEEntry method [4] assumes that the
DW_TAG_inlined_subroutine DIE and the abstract origin are in the same unit, and
uses a DW_FORM_ref4 for a cross-CU reference, leading to invalid DWARF being
emitted later.

Once again I'm still getting to grips with the nuances of DWARF emission, so
don't know exactly where we go wrong here.

[0] https://gist.github.com/MaskRay/4c67b29bb038d5a016260437c9e25a7a
[1]
https://github.com/llvm/llvm-project/blob/530d6ea97b884656d59e4701b40d9e6d546b4bef/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp#L573
[2]
https://github.com/llvm/llvm-project/blob/530d6ea97b884656d59e4701b40d9e6d546b4bef/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h#L96
[3]
https://github.com/llvm/llvm-project/blob/530d6ea97b884656d59e4701b40d9e6d546b4bef/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp#L641
[4]
https://github.com/llvm/llvm-project/blob/530d6ea97b884656d59e4701b40d9e6d546b4bef/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp#L384

-- 
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/20210212/9698785e/attachment-0001.html>


More information about the llvm-bugs mailing list