Index: lib/Support/Signals.cpp =================================================================== --- lib/Support/Signals.cpp +++ lib/Support/Signals.cpp @@ -26,15 +26,21 @@ #include "llvm/Support/Signals.h" #include "llvm/Support/StringSaver.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Support/Options.h" #include -namespace llvm { - //===----------------------------------------------------------------------===// //=== WARNING: Implementation here must contain only TRULY operating system //=== independent code. //===----------------------------------------------------------------------===// +using namespace llvm; + +static cl::opt + DisableSymbolication("disable-symbolication", + cl::desc("Disable symbolizing crash backtraces."), + cl::init(false), cl::Hidden); + static ManagedStatic>> CallBacksToRun; void sys::RunSignalHandlers() { @@ -44,9 +50,6 @@ I.first(I.second); CallBacksToRun->clear(); } -} - -using namespace llvm; static bool findModulesAndOffsets(void **StackTrace, int Depth, const char **Modules, intptr_t *Offsets, @@ -70,6 +73,9 @@ static bool printSymbolizedStackTrace(StringRef Argv0, void **StackTrace, int Depth, llvm::raw_ostream &OS) { + if (DisableSymbolication) + return false; + // Don't recursively invoke the llvm-symbolizer binary. if (Argv0.find("llvm-symbolizer") != std::string::npos) return false; Index: tools/bugpoint/OptimizerDriver.cpp =================================================================== --- tools/bugpoint/OptimizerDriver.cpp +++ tools/bugpoint/OptimizerDriver.cpp @@ -202,6 +202,7 @@ } else Args.push_back(tool.c_str()); + Args.push_back("-disable-symbolication"); Args.push_back("-o"); Args.push_back(OutputFilename.c_str()); for (unsigned i = 0, e = OptArgs.size(); i != e; ++i) Index: tools/bugpoint/ToolRunner.h =================================================================== --- tools/bugpoint/ToolRunner.h +++ tools/bugpoint/ToolRunner.h @@ -28,6 +28,7 @@ namespace llvm { extern cl::opt SaveTemps; +extern cl::opt EnableSymbolizer; extern Triple TargetTriple; class LLC; Index: tools/bugpoint/ToolRunner.cpp =================================================================== --- tools/bugpoint/ToolRunner.cpp +++ tools/bugpoint/ToolRunner.cpp @@ -29,6 +29,10 @@ namespace llvm { cl::opt SaveTemps("save-temps", cl::init(false), cl::desc("Save temporary files")); +cl::opt EnableSymbolizer( + "enable-symbolizer", cl::init(false), + cl::desc( + "Enable symbolized backtraces on crashes of processes under test")); } namespace { @@ -59,7 +63,8 @@ unsigned MemoryLimit = 0, std::string *ErrMsg = nullptr) { const StringRef *Redirects[3] = {&StdInFile, &StdOutFile, &StdErrFile}; - return sys::ExecuteAndWait(ProgramPath, Args, nullptr, Redirects, NumSeconds, + std::vector Env = {"LLVM_DISABLE_SYMBOLICATION"}; + return sys::ExecuteAndWait(ProgramPath, Args, Env.data(), Redirects, NumSeconds, MemoryLimit, ErrMsg); } @@ -77,8 +82,10 @@ unsigned MemoryLimit = 0) { const StringRef *Redirects[3] = {&StdInFile, &StdOutFile, &StdErrFile}; + std::vector Env = {"LLVM_DISABLE_SYMBOLICATION"}; + // Run the program remotely with the remote client - int ReturnCode = sys::ExecuteAndWait(RemoteClientPath, Args, nullptr, + int ReturnCode = sys::ExecuteAndWait(RemoteClientPath, Args, Env.data(), Redirects, NumSeconds, MemoryLimit); // Has the remote client fail?