diff options
Diffstat (limited to 'llvm/tools/bugpoint/CrashDebugger.cpp')
-rw-r--r-- | llvm/tools/bugpoint/CrashDebugger.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/tools/bugpoint/CrashDebugger.cpp b/llvm/tools/bugpoint/CrashDebugger.cpp index a472fff0975..0cae0669477 100644 --- a/llvm/tools/bugpoint/CrashDebugger.cpp +++ b/llvm/tools/bugpoint/CrashDebugger.cpp @@ -19,6 +19,7 @@ #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/IR/CFG.h" #include "llvm/IR/Constants.h" +#include "llvm/IR/DebugInfo.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/LegacyPassManager.h" @@ -54,6 +55,12 @@ cl::opt<bool> DontReducePassList("disable-pass-list-reduction", cl::opt<bool> NoNamedMDRM("disable-namedmd-remove", cl::desc("Do not remove global named metadata"), cl::init(false)); +cl::opt<bool> NoStripDebugInfo("disable-strip-debuginfo", + cl::desc("Do not strip debug info metadata"), + cl::init(false)); +cl::opt<bool> NoStripDebugTypeInfo("disable-strip-debug-types", + cl::desc("Do not strip debug type info metadata"), + cl::init(false)); cl::opt<bool> VerboseErrors("verbose-errors", cl::desc("Print the output of crashing program"), cl::init(false)); @@ -1123,6 +1130,22 @@ static Error DebugACrash(BugDriver &BD, if (Error E = ReduceInsts(BD, TestFn)) return E; + // Attempt to strip debug info metadata. + auto stripMetadata = [&](std::function<bool(Module &)> strip) { + std::unique_ptr<Module> M = CloneModule(BD.getProgram()); + strip(*M); + if (TestFn(BD, M.get())) + BD.setNewProgram(M.release()); + }; + if (!NoStripDebugInfo && !BugpointIsInterrupted) { + outs() << "\n*** Attempting to strip the debug info: "; + stripMetadata(StripDebugInfo); + } + if (!NoStripDebugTypeInfo && !BugpointIsInterrupted) { + outs() << "\n*** Attempting to strip the debug type info: "; + stripMetadata(stripNonLineTableDebugInfo); + } + if (!NoNamedMDRM) { if (!BugpointIsInterrupted) { // Try to reduce the amount of global metadata (particularly debug info), |