[llvm] r194898 - For dwarf4 use the correct form for referencing debug_loc locations,
Eric Christopher
echristo at gmail.com
Fri Nov 15 16:18:40 PST 2013
Author: echristo
Date: Fri Nov 15 18:18:40 2013
New Revision: 194898
URL: http://llvm.org/viewvc/llvm-project?rev=194898&view=rev
Log:
For dwarf4 use the correct form for referencing debug_loc locations,
and update test cases accordingly.
This doesn't affect the output dumped using llvm-dwarfdump, but
readelf does now dump the debug_loc section.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/test/DebugInfo/X86/block-capture.ll
llvm/trunk/test/DebugInfo/X86/op_deref.ll
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=194898&r1=194897&r2=194898&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Fri Nov 15 18:18:40 2013
@@ -1772,7 +1772,9 @@ DIE *CompileUnit::constructVariableDIE(D
unsigned Offset = DV.getDotDebugLocOffset();
if (Offset != ~0U) {
- addLabel(VariableDie, dwarf::DW_AT_location, dwarf::DW_FORM_data4,
+ addLabel(VariableDie, dwarf::DW_AT_location,
+ DD->getDwarfVersion() >= 4 ? dwarf::DW_FORM_sec_offset
+ : dwarf::DW_FORM_data4,
Asm->GetTempSymbol("debug_loc", Offset));
DV.setDIE(VariableDie);
return VariableDie;
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=194898&r1=194897&r2=194898&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Nov 15 18:18:40 2013
@@ -2118,7 +2118,7 @@ void DwarfDebug::emitDIE(DIE *Die, Array
case dwarf::DW_AT_location: {
if (DIELabel *L = dyn_cast<DIELabel>(Values[i])) {
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
- Asm->EmitLabelReference(L->getValue(), 4);
+ Asm->EmitSectionOffset(L->getValue(), DwarfDebugLocSectionSym);
else
Asm->EmitLabelDifference(L->getValue(), DwarfDebugLocSectionSym, 4);
} else {
Modified: llvm/trunk/test/DebugInfo/X86/block-capture.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/block-capture.ll?rev=194898&r1=194897&r2=194898&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/block-capture.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/block-capture.ll Fri Nov 15 18:18:40 2013
@@ -5,7 +5,7 @@
; CHECK: DW_TAG_subprogram [3]
; CHECK: DW_TAG_variable [5]
; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[{{.*}}] = "block")
-; CHECK: DW_AT_location [DW_FORM_data4] ({{.*}})
+; CHECK: DW_AT_location [DW_FORM_sec_offset] ({{.*}})
%struct.__block_descriptor = type { i64, i64 }
%struct.__block_literal_generic = type { i8*, i32, i32, i8*, %struct.__block_descriptor* }
Modified: llvm/trunk/test/DebugInfo/X86/op_deref.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/op_deref.ll?rev=194898&r1=194897&r2=194898&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/op_deref.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/op_deref.ll Fri Nov 15 18:18:40 2013
@@ -4,7 +4,7 @@
; DW-CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000067] = "vla")
; FIXME: The location here needs to be fixed, but llvm-dwarfdump doesn't handle
; DW_AT_location lists yet.
-; DW-CHECK: DW_AT_location [DW_FORM_data4] (0x00000000)
+; DW-CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000000)
; Unfortunately llvm-dwarfdump can't unparse a list of DW_AT_locations
; right now, so we check the asm output:
More information about the llvm-commits
mailing list