diff options
Diffstat (limited to 'llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp')
-rw-r--r-- | llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp index 14115c8..31de753 100644 --- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -243,7 +243,7 @@ static void error(StringRef Prefix, std::error_code EC) { exit(1); } -static DIDumpOptions getDumpOpts() { +static DIDumpOptions getDumpOpts(DWARFContext& C) { DIDumpOptions DumpOpts; DumpOpts.DumpType = DumpType; DumpOpts.ChildRecurseDepth = ChildRecurseDepth; @@ -254,6 +254,7 @@ static DIDumpOptions getDumpOpts() { DumpOpts.ShowForm = ShowForm; DumpOpts.SummarizeTypes = SummarizeTypes; DumpOpts.Verbose = Verbose; + DumpOpts.RecoverableErrorHandler = C.getRecoverableErrorHandler(); // In -verify mode, print DIEs without children in error messages. if (Verify) return DumpOpts.noImplicitRecursion(); @@ -294,6 +295,7 @@ using HandlerFn = std::function<bool(ObjectFile &, DWARFContext &DICtx, /// Print only DIEs that have a certain name. static bool filterByName(const StringSet<> &Names, DWARFDie Die, StringRef NameRef, raw_ostream &OS) { + DIDumpOptions DumpOpts = getDumpOpts(Die.getDwarfUnit()->getContext()); std::string Name = (IgnoreCase && !UseRegex) ? NameRef.lower() : NameRef.str(); if (UseRegex) { @@ -306,13 +308,13 @@ static bool filterByName(const StringSet<> &Names, DWARFDie Die, exit(1); } if (RE.match(Name)) { - Die.dump(OS, 0, getDumpOpts()); + Die.dump(OS, 0, DumpOpts); return true; } } } else if (Names.count(Name)) { // Match full text. - Die.dump(OS, 0, getDumpOpts()); + Die.dump(OS, 0, DumpOpts); return true; } return false; @@ -385,8 +387,9 @@ static void filterByAccelName(ArrayRef<std::string> Names, DWARFContext &DICtx, llvm::sort(Dies); Dies.erase(std::unique(Dies.begin(), Dies.end()), Dies.end()); + DIDumpOptions DumpOpts = getDumpOpts(DICtx); for (DWARFDie Die : Dies) - Die.dump(OS, 0, getDumpOpts()); + Die.dump(OS, 0, DumpOpts); } /// Handle the --lookup option and dump the DIEs and line info for the given @@ -402,7 +405,7 @@ static bool lookup(ObjectFile &Obj, DWARFContext &DICtx, uint64_t Address, if (!DIEsForAddr) return false; - DIDumpOptions DumpOpts = getDumpOpts(); + DIDumpOptions DumpOpts = getDumpOpts(DICtx); DumpOpts.ChildRecurseDepth = 0; DIEsForAddr.CompileUnit->dump(OS, DumpOpts); if (DIEsForAddr.FunctionDIE) { @@ -450,7 +453,7 @@ static bool dumpObjectFile(ObjectFile &Obj, DWARFContext &DICtx, } // Dump the complete DWARF structure. - DICtx.dump(OS, getDumpOpts(), DumpOffsets); + DICtx.dump(OS, getDumpOpts(DICtx), DumpOffsets); return true; } @@ -461,7 +464,7 @@ static bool verifyObjectFile(ObjectFile &Obj, DWARFContext &DICtx, raw_ostream &stream = Quiet ? nulls() : OS; stream << "Verifying " << Filename.str() << ":\tfile format " << Obj.getFileFormatName() << "\n"; - bool Result = DICtx.verify(stream, getDumpOpts()); + bool Result = DICtx.verify(stream, getDumpOpts(DICtx)); if (Result) stream << "No errors.\n"; else |