summaryrefslogtreecommitdiff
path: root/tools/bugpoint/bugpoint.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-01-13 19:48:54 +0000
committerDevang Patel <dpatel@apple.com>2011-01-13 19:48:54 +0000
commitbc8d5f11e7c34e4dff86b8cbcfa5f8be70ff69dd (patch)
treedecb58dd35025df26b7bf614c66d88b6c3a8fd51 /tools/bugpoint/bugpoint.cpp
parenta851fd8cd8e5c256651b3afeb8ebd539c28dfda7 (diff)
downloadllvm-bc8d5f11e7c34e4dff86b8cbcfa5f8be70ff69dd.tar.gz
llvm-bc8d5f11e7c34e4dff86b8cbcfa5f8be70ff69dd.tar.bz2
llvm-bc8d5f11e7c34e4dff86b8cbcfa5f8be70ff69dd.tar.xz
Little help to debug the bugpoint itself.
Patch by Bob Wilson. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123390 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint/bugpoint.cpp')
-rw-r--r--tools/bugpoint/bugpoint.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/bugpoint/bugpoint.cpp b/tools/bugpoint/bugpoint.cpp
index 385d446d4a..1ebe443f9f 100644
--- a/tools/bugpoint/bugpoint.cpp
+++ b/tools/bugpoint/bugpoint.cpp
@@ -27,6 +27,10 @@
#include "llvm/Support/Signals.h"
#include "llvm/Support/Valgrind.h"
#include "llvm/LinkAllVMCore.h"
+
+// Enable this macro to debug bugpoint itself.
+#define DEBUG_BUGPOINT 0
+
using namespace llvm;
static cl::opt<bool>
@@ -71,9 +75,11 @@ OverrideTriple("mtriple", cl::desc("Override target triple for module"));
/// BugpointIsInterrupted - Set to true when the user presses ctrl-c.
bool llvm::BugpointIsInterrupted = false;
+#ifndef DEBUG_BUGPOINT
static void BugpointInterruptFunction() {
BugpointIsInterrupted = true;
}
+#endif
// Hack to capture a pass list.
namespace {
@@ -91,9 +97,11 @@ namespace {
}
int main(int argc, char **argv) {
+#ifndef DEBUG_BUGPOINT
llvm::sys::PrintStackTraceOnErrorSignal();
llvm::PrettyStackTraceProgram X(argc, argv);
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
+#endif
// Initialize passes
PassRegistry &Registry = *PassRegistry::getPassRegistry();
@@ -111,7 +119,9 @@ int main(int argc, char **argv) {
"LLVM automatic testcase reducer. See\nhttp://"
"llvm.org/cmds/bugpoint.html"
" for more information.\n");
+#ifndef DEBUG_BUGPOINT
sys::SetInterruptFunction(BugpointInterruptFunction);
+#endif
LLVMContext& Context = getGlobalContext();
// If we have an override, set it and then track the triple we want Modules
@@ -160,7 +170,9 @@ int main(int argc, char **argv) {
// Bugpoint has the ability of generating a plethora of core files, so to
// avoid filling up the disk, we prevent it
+#ifndef DEBUG_BUGPOINT
sys::Process::PreventCoreFiles();
+#endif
std::string Error;
bool Failure = D.run(Error);