[llvm] r200425 - If we use DW_AT_ranges we need to specify a base address that ranges
Eric Christopher
echristo at gmail.com
Wed Jan 29 14:22:56 PST 2014
Author: echristo
Date: Wed Jan 29 16:22:56 2014
New Revision: 200425
URL: http://llvm.org/viewvc/llvm-project?rev=200425&view=rev
Log:
If we use DW_AT_ranges we need to specify a base address that ranges
are relative to in the compile unit. Currently let's just use 0...
Thanks to Greg Clayton for the catch!
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=200425&r1=200424&r2=200425&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Jan 29 16:22:56 2014
@@ -1054,11 +1054,17 @@ void DwarfDebug::finalizeModuleInfo() {
// FIXME: We should use ranges if we have multiple compile units or
// allow reordering of code ala .subsections_via_symbols in mach-o.
DwarfCompileUnit *U = SkCU ? SkCU : static_cast<DwarfCompileUnit *>(TheU);
- if (useCURanges() && TheU->getRanges().size())
+ if (useCURanges() && TheU->getRanges().size()) {
addSectionLabel(Asm, U, U->getUnitDie(), dwarf::DW_AT_ranges,
Asm->GetTempSymbol("cu_ranges", U->getUniqueID()),
DwarfDebugRangeSectionSym);
- else
+
+ // A DW_AT_low_pc attribute may also be specified in combination with
+ // DW_AT_ranges to specify the default base address for use in location
+ // lists (see Section 2.6.2) and range lists (see Section 2.17.3).
+ U->addUInt(U->getUnitDie(), dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
+ 0);
+ } else
U->addUInt(U->getUnitDie(), dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
0);
}
Modified: llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll?rev=200425&r1=200424&r2=200425&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll Wed Jan 29 16:22:56 2014
@@ -9,10 +9,12 @@
; CHECK: DW_TAG_compile_unit
; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
; CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000)
+; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
; CHECK: DW_TAG_compile_unit
; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset] (0x0000003c)
; CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000020)
+; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
; CHECK: .debug_line contents:
; CHECK-NEXT: Line table prologue:
@@ -27,10 +29,12 @@
; DWARF3: DW_TAG_compile_unit
; DWARF3: DW_AT_stmt_list [DW_FORM_data4] (0x00000000)
; DWARF3: DW_AT_ranges [DW_FORM_data4] (0x00000000)
+; DWARF3: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
; DWARF3: DW_TAG_compile_unit
; DWARF3: DW_AT_stmt_list [DW_FORM_data4] (0x0000003c)
; DWARF3: DW_AT_ranges [DW_FORM_data4] (0x00000020)
+; DWARF3: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
; DWARF3: .debug_line contents:
; DWARF3-NEXT: Line table prologue:
More information about the llvm-commits
mailing list