[PATCH] Use the DWARF form DW_FORM_sec_offset or DW_FORM_data4 depending on the Dwarf version being generated

Eric Christopher echristo at gmail.com
Thu Nov 21 15:51:21 PST 2013


I've gone ahead and applied this thusly (slightly modified):

M test/DebugInfo/X86/DW_AT_stmt_list_sec_offset.ll
M test/DebugInfo/X86/gnu-public-names.ll
M test/DebugInfo/X86/stmt-list-multiple-compile-units.ll
M test/DebugInfo/X86/op_deref.ll
M test/DebugInfo/X86/block-capture.ll
M lib/CodeGen/AsmPrinter/DIE.cpp
M lib/CodeGen/AsmPrinter/DwarfDebug.cpp
M lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
M lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
r195391 = 9e22df523d65f5200399bfe2dcdeeb900f75a054 (refs/remotes/origin/master)

FWIW llvm-dwarfdump does support dumping some locations but you'd have
to look at the actual debug_loc section to see if the right one
exists. Probably just need to fix the relocation handling and get the
addend in the relocation for DW_AT_location. It would be nice if that
was fixed for sure.

-eric

On Wed, Nov 20, 2013 at 5:49 PM, Keith Walker <kwalker at arm.com> wrote:
>   > From: Eric Christopher [mailto:echristo at gmail.com]
>   > Comment at: lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:234
>   > @@ +233,3 @@
>   > +                                  const MCSymbol *Label) {
>   > +  if (DD->getDwarfVersion() >= 4)
>   > +    addLabel(Die, Attribute, dwarf::DW_FORM_sec_offset, Label);
>   > ----------------
>   > I do apologize for the lateness of this comment, but rather than bringing this
>   > into addLabel I'd prefer we have a "getSectionOffset()" function that will return
>   > the proper form that can be used at the call site. Either that or make these
>   > function something like "addSectionOffset". Probably prefer the latter, but I'd
>   > want that patch to be more uniform across all of the additions.
>   >
>   > Make sense? That possible in the time you have?
>
>   I have updated the patch such that methods that use DW_FORM_sec_offset/DW_FORM_data4 are renames as follows:
>     addLabel() -> addSectionLabel()
>     addOffset() -> addSectionOffset()
>     addDelta() -> addSectionDelta()
>
>   Hopefully these changes are along the lines that make the usage clearer.
>
>   [I am on vacation this week so I am also bit slow responding :-) ]
>
> Hi echristo,
>
> http://llvm-reviews.chandlerc.com/D2180
>
> CHANGE SINCE LAST DIFF
>   http://llvm-reviews.chandlerc.com/D2180?vs=5632&id=5692#toc
>
> Files:
>   lib/CodeGen/AsmPrinter/DIE.cpp
>   lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>   lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
>   lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
>   test/DebugInfo/X86/block-capture.ll
>   test/DebugInfo/X86/DW_AT_stmt_list_sec_offset.ll
>   test/DebugInfo/X86/gnu-public-names.ll
>   test/DebugInfo/X86/stmt-list-multiple-compile-units.ll
>   test/DebugInfo/X86/op_deref.ll



More information about the llvm-commits mailing list