diff options
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFDie.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFDie.cpp | 56 |
1 files changed, 21 insertions, 35 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp index 22ae8ebb649..308f731570c 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp @@ -92,49 +92,35 @@ static void dumpLocation(raw_ostream &OS, DWARFFormValue &FormValue, } if (FormValue.isFormClass(DWARFFormValue::FC_SectionOffset)) { + auto LLDumpOpts = DumpOpts; + LLDumpOpts.Verbose = false; + uint64_t Offset = *FormValue.getAsSectionOffset(); uint64_t BaseAddr = 0; if (Optional<object::SectionedAddress> BA = U->getBaseAddress()) BaseAddr = BA->Address; - auto LLDumpOpts = DumpOpts; - LLDumpOpts.Verbose = false; - - if (!U->isDWOUnit() && !U->getLocSection()->Data.empty()) { - DWARFDebugLoc DebugLoc; - DWARFDataExtractor Data(Obj, *U->getLocSection(), Ctx.isLittleEndian(), - Obj.getAddressSize()); - - FormValue.dump(OS, DumpOpts); - OS << ": "; - if (Expected<DWARFDebugLoc::LocationList> LL = - DebugLoc.parseOneLocationList(Data, &Offset)) { - LL->dump(OS, BaseAddr, Ctx.isLittleEndian(), Obj.getAddressSize(), MRI, - U, LLDumpOpts, Indent); - } else { - OS << '\n'; - OS.indent(Indent); - OS << formatv("error extracting location list: {0}", - fmt_consume(LL.takeError())); - } + if (const DWARFLocationTable *LT = U->getLocationTable()) { + LT->dumpLocationList(&Offset, OS, BaseAddr, MRI, U, LLDumpOpts, Indent); return; } - bool UseLocLists = !U->isDWOUnit(); - auto Data = - UseLocLists - ? DWARFDataExtractor(Obj, Obj.getLoclistsSection(), - Ctx.isLittleEndian(), Obj.getAddressSize()) - : DWARFDataExtractor(U->getLocSectionData(), Ctx.isLittleEndian(), - Obj.getAddressSize()); - - if (!Data.getData().empty()) { - // Old-style location list were used in DWARF v4 (.debug_loc.dwo section). - // Modern locations list (.debug_loclists) are used starting from v5. - // Ideally we should take the version from the .debug_loclists section - // header, but using CU's version for simplicity. - DWARFDebugLoclists(Data, UseLocLists ? U->getVersion() : 4) - .dumpLocationList(&Offset, OS, BaseAddr, MRI, U, LLDumpOpts, Indent); + DWARFDebugLoc DebugLoc; + DWARFDataExtractor Data(Obj, *U->getLocSection(), Ctx.isLittleEndian(), + Obj.getAddressSize()); + + FormValue.dump(OS, DumpOpts); + OS << ": "; + + if (Expected<DWARFDebugLoc::LocationList> LL = + DebugLoc.parseOneLocationList(Data, &Offset)) { + LL->dump(OS, BaseAddr, Ctx.isLittleEndian(), Obj.getAddressSize(), MRI, U, + LLDumpOpts, Indent); + } else { + OS << '\n'; + OS.indent(Indent); + OS << formatv("error extracting location list: {0}", + fmt_consume(LL.takeError())); } return; } |