[PATCH] D33804: bugpoint: Prototype disabling symbolication of bugpoint-executed programs
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 9 00:29:35 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL305056: bugpoint: disabling symbolication of bugpoint-executed programs (authored by dblaikie).
Changed prior to commit:
https://reviews.llvm.org/D33804?vs=101121&id=101998#toc
Repository:
rL LLVM
https://reviews.llvm.org/D33804
Files:
llvm/trunk/lib/Support/Signals.cpp
llvm/trunk/test/BugPoint/unsymbolized.ll
llvm/trunk/tools/bugpoint/OptimizerDriver.cpp
Index: llvm/trunk/lib/Support/Signals.cpp
===================================================================
--- llvm/trunk/lib/Support/Signals.cpp
+++ llvm/trunk/lib/Support/Signals.cpp
@@ -26,15 +26,21 @@
#include "llvm/Support/Program.h"
#include "llvm/Support/StringSaver.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/Options.h"
#include <vector>
-namespace llvm {
-
//===----------------------------------------------------------------------===//
//=== WARNING: Implementation here must contain only TRULY operating system
//=== independent code.
//===----------------------------------------------------------------------===//
+using namespace llvm;
+
+static cl::opt<bool>
+ DisableSymbolication("disable-symbolication",
+ cl::desc("Disable symbolizing crash backtraces."),
+ cl::init(false), cl::Hidden);
+
static ManagedStatic<std::vector<std::pair<void (*)(void *), void *>>>
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: llvm/trunk/tools/bugpoint/OptimizerDriver.cpp
===================================================================
--- llvm/trunk/tools/bugpoint/OptimizerDriver.cpp
+++ llvm/trunk/tools/bugpoint/OptimizerDriver.cpp
@@ -202,10 +202,11 @@
} else
Args.push_back(tool.c_str());
- Args.push_back("-o");
- Args.push_back(OutputFilename.c_str());
for (unsigned i = 0, e = OptArgs.size(); i != e; ++i)
Args.push_back(OptArgs[i].c_str());
+ Args.push_back("-disable-symbolication");
+ Args.push_back("-o");
+ Args.push_back(OutputFilename.c_str());
std::vector<std::string> pass_args;
for (unsigned i = 0, e = PluginLoader::getNumPlugins(); i != e; ++i) {
pass_args.push_back(std::string("-load"));
Index: llvm/trunk/test/BugPoint/unsymbolized.ll
===================================================================
--- llvm/trunk/test/BugPoint/unsymbolized.ll
+++ llvm/trunk/test/BugPoint/unsymbolized.ll
@@ -0,0 +1,21 @@
+; REQUIRES: loadable_module
+; RUN: echo "import sys" > %t.py
+; RUN: echo "print('args = ' + str(sys.argv))" >> %t.py
+; RUN: echo "exit(1)" >> %t.py
+; RUN: not bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -opt-command="%python" -opt-args %t.py | FileCheck %s
+; RUN: not --crash opt -load %llvmshlibdir/BugpointPasses%shlibext %s -bugpoint-crashcalls -disable-symbolication 2>&1 | FileCheck --check-prefix=CRASH %s
+
+; Test that bugpoint disables symbolication on the opt tool to reduce runtime overhead when opt crashes
+; CHECK: args = {{.*}}'-disable-symbolication'
+
+; Test that opt, when it crashes & is passed -disable-symbolication, doesn't symbolicate.
+; In theory this test should maybe be in test/tools/opt or
+; test/Transforms, but since there doesn't seem to be another convenient way to
+; crash opt, apart from the BugpointPasses dynamic plugin, this is the spot for
+; now.
+; CRASH-NOT: Signals.inc
+
+define void @f() {
+ call void @f()
+ ret void
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33804.101998.patch
Type: text/x-patch
Size: 3652 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170609/0e6232fa/attachment.bin>
More information about the llvm-commits
mailing list