diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -192,17 +192,18 @@ Optional DWARFUnit::getAddrOffsetSectionItem(uint32_t Index) const { - if (IsDWO) { + if (!AddrOffsetSectionBase) { auto R = Context.info_section_units(); // 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 (hasSingleElement(R)) + if (IsDWO && hasSingleElement(R)) { return (*R.begin())->getAddrOffsetSectionItem(Index); - } - if (!AddrOffsetSectionBase) + } return None; + } + uint64_t Offset = *AddrOffsetSectionBase + Index * getAddressByteSize(); if (AddrOffsetSection->Data.size() < Offset + getAddressByteSize()) return None; diff --git a/llvm/test/DebugInfo/Inputs/splitdwarf-single-issue b/llvm/test/DebugInfo/Inputs/splitdwarf-single-issue new file mode 100755 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@