diff options
author | David Blaikie <dblaikie@gmail.com> | 2018-10-24 22:44:54 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2018-10-24 22:44:54 +0000 |
commit | c8ae09673969e7b179fe419d780d1d0f2d2c2c19 (patch) | |
tree | de1489cffc8d47cf843443bd84bf69a0639812dd | |
parent | 7e6448bb02e67e4b3ad26667d2ac95627104abfd (diff) | |
download | bcm5719-llvm-c8ae09673969e7b179fe419d780d1d0f2d2c2c19.tar.gz bcm5719-llvm-c8ae09673969e7b179fe419d780d1d0f2d2c2c19.zip |
llvm-dwarfdump: Account for skeleton addr_base when dumping addresses in split unit in the same file
llvm-svn: 345215
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp | 10 | ||||
-rw-r--r-- | llvm/test/DebugInfo/X86/split-dwarf-v5-ranges.ll | 4 |
2 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp index 4cf1f938c3e..9d75dc94604 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -197,6 +197,16 @@ DWARFDataExtractor DWARFUnit::getDebugInfoExtractor() const { 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; diff --git a/llvm/test/DebugInfo/X86/split-dwarf-v5-ranges.ll b/llvm/test/DebugInfo/X86/split-dwarf-v5-ranges.ll index 4404d5c3639..295bbc41ad3 100644 --- a/llvm/test/DebugInfo/X86/split-dwarf-v5-ranges.ll +++ b/llvm/test/DebugInfo/X86/split-dwarf-v5-ranges.ll @@ -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 |