Add a stub for debugging code generator crashes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11602 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2004-02-18 21:02:04 +00:00
parent a3de11783f
commit 025262692a
4 changed files with 49 additions and 18 deletions
+24 -7
View File
@@ -19,6 +19,7 @@
#include "llvm/Assembly/Parser.h"
#include "llvm/Bytecode/Reader.h"
#include "llvm/Transforms/Utils/Linker.h"
#include "llvm/Support/ToolRunner.h"
#include "Support/CommandLine.h"
#include "Support/FileUtilities.h"
#include <memory>
@@ -131,7 +132,7 @@ bool BugDriver::run() {
if (!PassesToRun.empty()) {
std::cout << "Running selected passes on program to test for crash: ";
if (runPasses(PassesToRun))
return debugCrash();
return debugOptimizerCrash();
}
// Set up the execution environment, selecting a method to run LLVM bytecode.
@@ -144,9 +145,20 @@ bool BugDriver::run() {
bool CreatedOutput = false;
if (ReferenceOutputFile.empty()) {
std::cout << "Generating reference output from raw program...";
ReferenceOutputFile = executeProgramWithCBE("bugpoint.reference.out");
CreatedOutput = true;
std::cout << "Reference output is: " << ReferenceOutputFile << "\n";
try {
ReferenceOutputFile = executeProgramWithCBE("bugpoint.reference.out");
CreatedOutput = true;
std::cout << "Reference output is: " << ReferenceOutputFile << "\n";
} catch (ToolExecutionError &TEE) {
std::cerr << TEE.getMessage();
if (Interpreter != cbe) {
std::cerr << "*** There is a bug running the C backend. Either debug"
<< " it (use the -run-cbe bugpoint option), or fix the error"
<< " some other way.\n";
return 1;
}
return debugCodeGeneratorCrash();
}
}
// Make sure the reference output file gets deleted on exit from this
@@ -156,9 +168,14 @@ bool BugDriver::run() {
// Diff the output of the raw program against the reference output. If it
// matches, then we have a miscompilation bug.
std::cout << "*** Checking the code generator...\n";
if (!diffProgram()) {
std::cout << "\n*** Debugging miscompilation!\n";
return debugMiscompilation();
try {
if (!diffProgram()) {
std::cout << "\n*** Debugging miscompilation!\n";
return debugMiscompilation();
}
} catch (ToolExecutionError &TEE) {
std::cerr << TEE.getMessage() << "*** Debugging code generator crash!\n";
return debugCodeGeneratorCrash();
}
std::cout << "\n*** Input program does not match reference diff!\n";