summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2017-09-16 16:58:18 +0000
committerAdrian Prantl <aprantl@apple.com>2017-09-16 16:58:18 +0000
commit099d7e452a68ca43de6231ff8b19f14b84ce61ca (patch)
treeefc41754ffc0c4769dc3e9d86d7359dc5c9e1846 /llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
parent19a0a3ab685ddb8266df71557902cce870f10145 (diff)
downloadbcm5719-llvm-099d7e452a68ca43de6231ff8b19f14b84ce61ca.tar.gz
bcm5719-llvm-099d7e452a68ca43de6231ff8b19f14b84ce61ca.zip
llvm-dwarfdump: Add support for -debug-types=<offset>.
llvm-svn: 313463
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFContext.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFContext.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 3914b5a441a..02d37f21c38 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -270,19 +270,22 @@ void DWARFContext::dump(
dumpDebugInfo(ExplicitDWO, ".debug_info.dwo", DObj->getInfoDWOSection(),
dwo_compile_units());
- if ((DumpType & DIDT_DebugTypes)) {
- if (Explicit || getNumTypeUnits()) {
- OS << "\n.debug_types contents:\n";
- for (const auto &TUS : type_unit_sections())
- for (const auto &TU : TUS)
+ auto dumpDebugType = [&](const char *Name,
+ tu_section_iterator_range TUSections) {
+ OS << '\n' << Name << " contents:\n";
+ DumpOffset = DumpOffsets[DIDT_ID_DebugTypes];
+ for (const auto &TUS : TUSections)
+ for (const auto &TU : TUS)
+ if (DumpOffset)
+ TU->getDIEForOffset(*DumpOffset).dump(OS, 0);
+ else
TU->dump(OS, DumpOpts);
- }
- if (ExplicitDWO || getNumDWOTypeUnits()) {
- OS << "\n.debug_types.dwo contents:\n";
- for (const auto &DWOTUS : dwo_type_unit_sections())
- for (const auto &DWOTU : DWOTUS)
- DWOTU->dump(OS, DumpOpts);
- }
+ };
+ if ((DumpType & DIDT_DebugTypes)) {
+ if (Explicit || getNumTypeUnits())
+ dumpDebugType(".debug_types", type_unit_sections());
+ if (ExplicitDWO || getNumDWOTypeUnits())
+ dumpDebugType(".debug_types.dwo", dwo_type_unit_sections());
}
if (shouldDump(Explicit, ".debug_loc", DIDT_ID_DebugLoc,
OpenPOWER on IntegriCloud