From 9c71e1d903576253e3bef8ed6f4e82979e75e949 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Mon, 18 Sep 2017 19:55:00 +0000 Subject: [PATCH] llvm-dwarfdump: Sink the handling of ShowChildren into DWARFDie::dump(). NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313560 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/DebugInfo/DWARF/DWARFContext.cpp | 6 ++---- lib/DebugInfo/DWARF/DWARFDie.cpp | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/DebugInfo/DWARF/DWARFContext.cpp b/lib/DebugInfo/DWARF/DWARFContext.cpp index 353a5bad997..0aacd0c5231 100644 --- a/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -222,8 +222,6 @@ void DWARFContext::dump( Optional DumpOffset; uint64_t DumpType = DumpOpts.DumpType; - unsigned RecDepth = - DumpOpts.ShowChildren ? std::numeric_limits::max() : 0; StringRef Extension = sys::path::extension(DObj->getFileName()); bool IsDWO = (Extension == ".dwo") || (Extension == ".dwp"); @@ -261,7 +259,7 @@ void DWARFContext::dump( if (shouldDump(IsExplicit, Name, DIDT_ID_DebugInfo, Section.Data)) { for (const auto &CU : CUs) if (DumpOffset) - CU->getDIEForOffset(DumpOffset.getValue()).dump(OS, RecDepth); + CU->getDIEForOffset(DumpOffset.getValue()).dump(OS, 0, 0, DumpOpts); else CU->dump(OS, DumpOpts); } @@ -278,7 +276,7 @@ void DWARFContext::dump( for (const auto &TUS : TUSections) for (const auto &TU : TUS) if (DumpOffset) - TU->getDIEForOffset(*DumpOffset).dump(OS, RecDepth); + TU->getDIEForOffset(*DumpOffset).dump(OS, 0, 0, DumpOpts); else TU->dump(OS, DumpOpts); }; diff --git a/lib/DebugInfo/DWARF/DWARFDie.cpp b/lib/DebugInfo/DWARF/DWARFDie.cpp index 1af9c8001bb..57734984d75 100644 --- a/lib/DebugInfo/DWARF/DWARFDie.cpp +++ b/lib/DebugInfo/DWARF/DWARFDie.cpp @@ -374,6 +374,7 @@ void DWARFDie::dump(raw_ostream &OS, unsigned RecurseDepth, unsigned Indent, DWARFDataExtractor debug_info_data = U->getDebugInfoExtractor(); const uint32_t Offset = getOffset(); uint32_t offset = Offset; + RecurseDepth += DumpOpts.ShowChildren ? 1 : 0; if (debug_info_data.isValidOffset(offset)) { uint32_t abbrCode = debug_info_data.getULEB128(&offset); -- 2.40.0