diff options
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFContext.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp index c5766b4440d..e13b3836b13 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -300,11 +300,21 @@ static void dumpLoclistsSection(raw_ostream &OS, DIDumpOptions DumpOpts, Header.dump(OS, DumpOpts); - DWARFDebugLoclists Loclists; uint64_t EndOffset = Header.length() + Header.getHeaderOffset(); Data.setAddressSize(Header.getAddrSize()); - Loclists.parse(Data, Offset, EndOffset, Header.getVersion()); - Loclists.dump(OS, 0, MRI, DumpOpts, DumpOffset); + if (DumpOffset) { + if (DumpOffset >= Offset && DumpOffset < EndOffset) { + Offset = *DumpOffset; + DWARFDebugLoclists::dumpLocationList(Data, &Offset, Header.getVersion(), + OS, /*BaseAddr=*/0, MRI, nullptr, + DumpOpts, /*Indent=*/0); + OS << "\n"; + return; + } + } else { + DWARFDebugLoclists::dumpRange(Data, Offset, EndOffset - Offset, + Header.getVersion(), OS, 0, MRI, DumpOpts); + } Offset = EndOffset; } } @@ -393,7 +403,19 @@ void DWARFContext::dump( if (const auto *Off = shouldDump(ExplicitDWO, ".debug_loc.dwo", DIDT_ID_DebugLoc, DObj->getLocDWOSection().Data)) { - getDebugLocDWO()->dump(OS, 0, getRegisterInfo(), DumpOpts, *Off); + DWARFDataExtractor Data(*DObj, DObj->getLocDWOSection(), isLittleEndian(), + 4); + if (*Off) { + uint64_t Offset = **Off; + DWARFDebugLoclists::dumpLocationList(Data, &Offset, /*Version=*/4, OS, + /*BaseAddr=*/0, getRegisterInfo(), + nullptr, DumpOpts, /*Indent=*/0); + OS << "\n"; + } else { + DWARFDebugLoclists::dumpRange(Data, 0, Data.getData().size(), + /*Version=*/4, OS, /*BaseAddr=*/0, + getRegisterInfo(), DumpOpts); + } } if (const auto *Off = shouldDump(Explicit, ".debug_frame", DIDT_ID_DebugFrame, @@ -724,23 +746,6 @@ const DWARFDebugLoc *DWARFContext::getDebugLoc() { return Loc.get(); } -const DWARFDebugLoclists *DWARFContext::getDebugLocDWO() { - if (LocDWO) - return LocDWO.get(); - - LocDWO.reset(new DWARFDebugLoclists()); - // Assume all compile units have the same address byte size. - // FIXME: We don't need AddressSize for split DWARF since relocatable - // addresses cannot appear there. At the moment DWARFExpression requires it. - DWARFDataExtractor LocData(*DObj, DObj->getLocDWOSection(), isLittleEndian(), - 4); - // Use version 4. DWO does not support the DWARF v5 .debug_loclists yet and - // that means we are parsing the new style .debug_loc (pre-standatized version - // of the .debug_loclists). - LocDWO->parse(LocData, 0, LocData.getData().size(), 4 /* Version */); - return LocDWO.get(); -} - const DWARFDebugAranges *DWARFContext::getDebugAranges() { if (Aranges) return Aranges.get(); |