llvm-dwarfdump: support a --show-children option
This will print all children of a DIE when selectively printing only
one DIE at a given offset.
llvm-svn: 313464
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 02d37f2..373452a 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -223,6 +223,8 @@
Optional<uint64_t> DumpOffset;
uint64_t DumpType = DumpOpts.DumpType;
bool DumpEH = DumpOpts.DumpEH;
+ unsigned RecDepth =
+ DumpOpts.ShowChildren ? std::numeric_limits<unsigned>::max() : 0;
StringRef Extension = sys::path::extension(DObj->getFileName());
bool IsDWO = (Extension == ".dwo") || (Extension == ".dwp");
@@ -260,7 +262,7 @@
if (shouldDump(IsExplicit, Name, DIDT_ID_DebugInfo, Section.Data)) {
for (const auto &CU : CUs)
if (DumpOffset)
- CU->getDIEForOffset(DumpOffset.getValue()).dump(OS, 0);
+ CU->getDIEForOffset(DumpOffset.getValue()).dump(OS, RecDepth);
else
CU->dump(OS, DumpOpts);
}
@@ -277,7 +279,7 @@
for (const auto &TUS : TUSections)
for (const auto &TU : TUS)
if (DumpOffset)
- TU->getDIEForOffset(*DumpOffset).dump(OS, 0);
+ TU->getDIEForOffset(*DumpOffset).dump(OS, RecDepth);
else
TU->dump(OS, DumpOpts);
};