From 9e02d336e7b365ffa7f7c6747631d83db63a04b2 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 19 Feb 2004 17:03:49 +0000 Subject: [PATCH] Be a bit more robust. Explicitly check for a code generator crash. llvm-svn: 11624 --- tools/bugpoint/BugDriver.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp index d3a57f4afe2..07261257a77 100644 --- a/tools/bugpoint/BugDriver.cpp +++ b/tools/bugpoint/BugDriver.cpp @@ -147,6 +147,16 @@ bool BugDriver::run() { // Set up the execution environment, selecting a method to run LLVM bytecode. if (initializeExecutionEnvironment()) return true; + // Test to see if we have a code generator crash. + std::cout << "Running the code generator to test for a crash: "; + try { + compileProgram(Program); + } catch (ToolExecutionError &TEE) { + std::cout << TEE.what(); + return debugCodeGeneratorCrash(); + } + + // Run the raw input to see where we are coming from. If a reference output // was specified, make sure that the raw output matches it. If not, it's a // problem in the front-end or the code generator. @@ -189,7 +199,12 @@ bool BugDriver::run() { std::cout << "\n*** Input program does not match reference diff!\n"; std::cout << "Debugging code generator problem!\n"; - return debugCodeGenerator(); + try { + return debugCodeGenerator(); + } catch (ToolExecutionError &TEE) { + std::cerr << TEE.what(); + return debugCodeGeneratorCrash(); + } } void BugDriver::PrintFunctionList(const std::vector &Funcs) {