summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFDie.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDie.cpp46
1 files changed, 26 insertions, 20 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
index f278a7a205e..ebc8cc565f3 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
@@ -91,30 +91,32 @@ static void dumpLocation(raw_ostream &OS, DWARFFormValue &FormValue,
return;
}
- FormValue.dump(OS, DumpOpts);
- const auto &DumpLL = [&](auto ExpectedLL) {
- if (ExpectedLL) {
- uint64_t BaseAddr = 0;
- if (Optional<object::SectionedAddress> BA = U->getBaseAddress())
- BaseAddr = BA->Address;
- auto LLDumpOpts = DumpOpts;
- LLDumpOpts.Verbose = false;
- ExpectedLL->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(ExpectedLL.takeError()));
- }
- };
if (FormValue.isFormClass(DWARFFormValue::FC_SectionOffset)) {
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());
- DumpLL(DebugLoc.parseOneLocationList(Data, &Offset));
+
+ 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;
}
@@ -131,10 +133,14 @@ static void dumpLocation(raw_ostream &OS, DWARFFormValue &FormValue,
// 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.
- DumpLL(DWARFDebugLoclists::parseOneLocationList(
- Data, &Offset, UseLocLists ? U->getVersion() : 4));
+ DWARFDebugLoclists::dumpLocationList(
+ Data, &Offset, UseLocLists ? U->getVersion() : 4, OS, BaseAddr, MRI,
+ U, LLDumpOpts, Indent);
}
+ return;
}
+
+ FormValue.dump(OS, DumpOpts);
}
/// Dump the name encoded in the type tag.
OpenPOWER on IntegriCloud