diff options
| author | Adrian Prantl <aprantl@apple.com> | 2017-09-20 17:44:00 +0000 |
|---|---|---|
| committer | Adrian Prantl <aprantl@apple.com> | 2017-09-20 17:44:00 +0000 |
| commit | d3f9f2138d953025cf46720138ee41dd567e5b4d (patch) | |
| tree | 57f159b25464655b5e4eddef36f9f725ec6f5d9b /llvm/tools | |
| parent | 8b250344e9bbf2d61c329cef7d5ee90b7a9cd44f (diff) | |
| download | bcm5719-llvm-d3f9f2138d953025cf46720138ee41dd567e5b4d.tar.gz bcm5719-llvm-d3f9f2138d953025cf46720138ee41dd567e5b4d.zip | |
llvm-dwarfdump: implement --recurse-depth=<N>
This patch implements the Darwin dwarfdump option --recurse-depth=<N>,
which limits the recursion depth when selectively printing DIEs at an
offset.
Differential Revision: https://reviews.llvm.org/D38064
llvm-svn: 313778
Diffstat (limited to 'llvm/tools')
| -rw-r--r-- | llvm/tools/dsymutil/DwarfLinker.cpp | 12 | ||||
| -rw-r--r-- | llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp | 11 |
2 files changed, 19 insertions, 4 deletions
diff --git a/llvm/tools/dsymutil/DwarfLinker.cpp b/llvm/tools/dsymutil/DwarfLinker.cpp index b91b80ea08e..3ab3c7f5720 100644 --- a/llvm/tools/dsymutil/DwarfLinker.cpp +++ b/llvm/tools/dsymutil/DwarfLinker.cpp @@ -1744,10 +1744,11 @@ void DwarfLinker::reportWarning(const Twine &Warning, return; DIDumpOptions DumpOpts; + DumpOpts.RecurseDepth = 0; DumpOpts.Verbose = Options.Verbose; errs() << " in DIE:\n"; - DIE->dump(errs(), 0 /* RecurseDepth */, 6 /* Indent */, DumpOpts); + DIE->dump(errs(), 6 /* Indent */, DumpOpts); } bool DwarfLinker::createStreamer(const Triple &TheTriple, @@ -2112,8 +2113,9 @@ unsigned DwarfLinker::shouldKeepVariableDIE(RelocationManager &RelocMgr, if (Options.Verbose) { DIDumpOptions DumpOpts; + DumpOpts.RecurseDepth = 0; DumpOpts.Verbose = Options.Verbose; - DIE.dump(outs(), 0, 8 /* Indent */, DumpOpts); + DIE.dump(outs(), 8 /* Indent */, DumpOpts); } return Flags | TF_Keep; @@ -2147,8 +2149,9 @@ unsigned DwarfLinker::shouldKeepSubprogramDIE( if (Options.Verbose) { DIDumpOptions DumpOpts; + DumpOpts.RecurseDepth = 0; DumpOpts.Verbose = Options.Verbose; - DIE.dump(outs(), 0, 8 /* Indent */, DumpOpts); + DIE.dump(outs(), 8 /* Indent */, DumpOpts); } Flags |= TF_Keep; @@ -3486,8 +3489,9 @@ bool DwarfLinker::link(const DebugMap &Map) { if (Options.Verbose) { outs() << "Input compilation unit:"; DIDumpOptions DumpOpts; + DumpOpts.RecurseDepth = 0; DumpOpts.Verbose = Options.Verbose; - CUDie.dump(outs(), 0, 0, DumpOpts); + CUDie.dump(outs(), 0, DumpOpts); } if (!registerModuleReference(CUDie, *CU, ModuleMap)) { diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp index 61d77aa76f4..aba59d0d5b9 100644 --- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -144,6 +144,13 @@ static opt<bool> cat(DwarfDumpCategory)); static alias ShowParentsAlias("p", desc("Alias for -show-parents"), aliasopt(ShowParents)); +static opt<unsigned> RecurseDepth( + "recurse-depth", + desc("Only recurse to a depth of N when displaying debug info entries."), + cat(DwarfDumpCategory), init(-1U), value_desc("N")); +static alias RecurseDepthAlias("r", desc("Alias for -recurse-depth"), + aliasopt(RecurseDepth)); + static opt<bool> SummarizeTypes("summarize-types", desc("Abbreviate the description of type unit entries"), @@ -172,10 +179,14 @@ static void error(StringRef Filename, std::error_code EC) { static DIDumpOptions getDumpOpts() { DIDumpOptions DumpOpts; DumpOpts.DumpType = DumpType; + DumpOpts.RecurseDepth = RecurseDepth; DumpOpts.ShowChildren = ShowChildren; DumpOpts.ShowParents = ShowParents; DumpOpts.SummarizeTypes = SummarizeTypes; DumpOpts.Verbose = Verbose; + // In -verify mode, print DIEs without children in error messages. + if (Verify) + return DumpOpts.noImplicitRecursion(); return DumpOpts; } |

