[llvm] r345215 - llvm-dwarfdump: Account for skeleton addr_base when dumping addresses in split unit in the same file

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 24 15:44:54 PDT 2018


Author: dblaikie
Date: Wed Oct 24 15:44:54 2018
New Revision: 345215

URL: http://llvm.org/viewvc/llvm-project?rev=345215&view=rev
Log:
llvm-dwarfdump: Account for skeleton addr_base when dumping addresses in split unit in the same file

Modified:
    llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp
    llvm/trunk/test/DebugInfo/X86/split-dwarf-v5-ranges.ll

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp?rev=345215&r1=345214&r2=345215&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp Wed Oct 24 15:44:54 2018
@@ -197,6 +197,16 @@ DWARFDataExtractor DWARFUnit::getDebugIn
 
 Optional<SectionedAddress>
 DWARFUnit::getAddrOffsetSectionItem(uint32_t Index) const {
+  if (isDWO) {
+    auto R = Context.info_section_units();
+    auto I = R.begin();
+    // Surprising if a DWO file has more than one skeleton unit in it - this
+    // probably shouldn't be valid, but if a use case is found, here's where to
+    // support it (probably have to linearly search for the matching skeleton CU
+    // here)
+    if (I != R.end() && std::next(I) == R.end())
+      return (*I)->getAddrOffsetSectionItem(Index);
+  }
   uint32_t Offset = AddrOffsetSectionBase + Index * getAddressByteSize();
   if (AddrOffsetSection->Data.size() < Offset + getAddressByteSize())
     return None;

Modified: llvm/trunk/test/DebugInfo/X86/split-dwarf-v5-ranges.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/split-dwarf-v5-ranges.ll?rev=345215&r1=345214&r2=345215&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/split-dwarf-v5-ranges.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/split-dwarf-v5-ranges.ll Wed Oct 24 15:44:54 2018
@@ -4,8 +4,8 @@
 ; CHECK: .debug_info contents:
 ; CHECK: .debug_info.dwo contents:
 ; CHECK: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x0) rangelist = 0x00000004
-; CHECK:          [0x0000000000000000, 0x000000000000000b) "x"
-; CHECK:          [0x000000000000000d, 0x0000000000000012) "x")
+; CHECK:          [0x0000000000000001, 0x000000000000000c) ".text"
+; CHECK:          [0x000000000000000e, 0x0000000000000013) ".text")
 
 ; CHECK: .debug_rnglists.dwo contents:
 ; CHECK: 0x00000000: range list header: length = 0x00000015, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000001




More information about the llvm-commits mailing list