summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFAddressRange.cpp8
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFContext.cpp13
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp12
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDie.cpp13
4 files changed, 26 insertions, 20 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFAddressRange.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAddressRange.cpp
index ef6da08d34a..ddf307de222 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFAddressRange.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFAddressRange.cpp
@@ -7,19 +7,23 @@
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/DWARF/DWARFAddressRange.h"
-
+#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
void DWARFAddressRange::dump(raw_ostream &OS, uint32_t AddressSize,
- DIDumpOptions DumpOpts) const {
+ DIDumpOptions DumpOpts,
+ const DWARFObject *Obj) const {
OS << (DumpOpts.DisplayRawContents ? " " : "[");
OS << format("0x%*.*" PRIx64 ", ", AddressSize * 2, AddressSize * 2, LowPC)
<< format("0x%*.*" PRIx64, AddressSize * 2, AddressSize * 2, HighPC);
OS << (DumpOpts.DisplayRawContents ? "" : ")");
+
+ if (Obj)
+ DWARFFormValue::dumpAddressSection(*Obj, OS, DumpOpts, SectionIndex);
}
raw_ostream &llvm::operator<<(raw_ostream &OS, const DWARFAddressRange &R) {
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 3fad575ff40..3071f637b5a 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -388,16 +388,20 @@ void DWARFContext::dump(
dumpDebugType(".debug_types.dwo", dwo_types_section_units());
}
+ DIDumpOptions LLDumpOpts = DumpOpts;
+ if (LLDumpOpts.Verbose)
+ LLDumpOpts.DisplayRawContents = true;
+
if (const auto *Off = shouldDump(Explicit, ".debug_loc", DIDT_ID_DebugLoc,
DObj->getLocSection().Data)) {
- getDebugLoc()->dump(OS, getRegisterInfo(), DumpOpts, *Off);
+ getDebugLoc()->dump(OS, getRegisterInfo(), LLDumpOpts, *Off);
}
if (const auto *Off =
shouldDump(Explicit, ".debug_loclists", DIDT_ID_DebugLoclists,
DObj->getLoclistsSection().Data)) {
DWARFDataExtractor Data(*DObj, DObj->getLoclistsSection(), isLittleEndian(),
0);
- dumpLoclistsSection(OS, DumpOpts, Data, getRegisterInfo(), *Off);
+ dumpLoclistsSection(OS, LLDumpOpts, Data, getRegisterInfo(), *Off);
}
if (const auto *Off =
shouldDump(ExplicitDWO, ".debug_loc.dwo", DIDT_ID_DebugLoc,
@@ -409,10 +413,11 @@ void DWARFContext::dump(
uint64_t Offset = **Off;
Loc.dumpLocationList(&Offset, OS,
/*BaseAddr=*/None, getRegisterInfo(), nullptr,
- DumpOpts, /*Indent=*/0);
+ LLDumpOpts, /*Indent=*/0);
OS << "\n";
} else {
- Loc.dumpRange(0, Data.getData().size(), OS, getRegisterInfo(), DumpOpts);
+ Loc.dumpRange(0, Data.getData().size(), OS, getRegisterInfo(),
+ LLDumpOpts);
}
}
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
index 218bf381567..1af51a85d18 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
@@ -115,14 +115,20 @@ bool DWARFLocationTable::dumpLocationList(uint64_t *Offset, raw_ostream &OS,
OS << format("0x%8.8" PRIx64 ": ", *Offset);
Error E = visitLocationList(Offset, [&](const DWARFLocationEntry &E) {
Expected<Optional<DWARFLocationExpression>> Loc = Interp.Interpret(E);
- if (!Loc || DumpOpts.Verbose)
+ if (!Loc || DumpOpts.DisplayRawContents)
dumpRawEntry(E, OS, Indent);
if (Loc && *Loc) {
OS << "\n";
OS.indent(Indent);
- if (DumpOpts.Verbose)
+ if (DumpOpts.DisplayRawContents)
OS << " => ";
- Loc.get()->Range->dump(OS, Data.getAddressSize(), DumpOpts);
+
+ DIDumpOptions RangeDumpOpts(DumpOpts);
+ RangeDumpOpts.DisplayRawContents = false;
+ const DWARFObject *Obj = nullptr;
+ if (U)
+ Obj = &U->getContext().getDWARFObj();
+ Loc.get()->Range->dump(OS, Data.getAddressSize(), RangeDumpOpts, Obj);
}
if (!Loc)
consumeError(Loc.takeError());
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
index 7fa72b1bb57..a11865e048c 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
@@ -62,16 +62,10 @@ static void dumpRanges(const DWARFObject &Obj, raw_ostream &OS,
if (!DumpOpts.ShowAddresses)
return;
- ArrayRef<SectionName> SectionNames;
- if (DumpOpts.Verbose)
- SectionNames = Obj.getSectionNames();
-
for (const DWARFAddressRange &R : Ranges) {
OS << '\n';
OS.indent(Indent);
- R.dump(OS, AddressSize);
-
- DWARFFormValue::dumpAddressSection(Obj, OS, DumpOpts, R.SectionIndex);
+ R.dump(OS, AddressSize, DumpOpts, &Obj);
}
}
@@ -91,9 +85,6 @@ 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();
if (FormValue.getForm() == DW_FORM_loclistx) {
@@ -104,7 +95,7 @@ static void dumpLocation(raw_ostream &OS, DWARFFormValue &FormValue,
return;
}
U->getLocationTable().dumpLocationList(&Offset, OS, U->getBaseAddress(),
- MRI, U, LLDumpOpts, Indent);
+ MRI, U, DumpOpts, Indent);
return;
}
OpenPOWER on IntegriCloud