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

llvm-svn: 345215
This commit is contained in:
David Blaikie 2018-10-24 22:44:54 +00:00
parent 7e6448bb02
commit c8ae096739
2 changed files with 12 additions and 2 deletions

View File

@ -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;

View File

@ -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