[llvm-commits] CVS: llvm/tools/bugpoint/BugDriver.cpp BugDriver.h CrashDebugger.cpp Miscompilation.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Feb 18 15:16:00 PST 2004
Changes in directory llvm/tools/bugpoint:
BugDriver.cpp updated: 1.24 -> 1.25
BugDriver.h updated: 1.24 -> 1.25
CrashDebugger.cpp updated: 1.27 -> 1.28
Miscompilation.cpp updated: 1.26 -> 1.27
---
Log message:
Add a stub for debugging code generator crashes
---
Diffs of the changes: (+49 -18)
Index: llvm/tools/bugpoint/BugDriver.cpp
diff -u llvm/tools/bugpoint/BugDriver.cpp:1.24 llvm/tools/bugpoint/BugDriver.cpp:1.25
--- llvm/tools/bugpoint/BugDriver.cpp:1.24 Wed Feb 18 14:22:25 2004
+++ llvm/tools/bugpoint/BugDriver.cpp Wed Feb 18 15:02:04 2004
@@ -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 @@
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 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 @@
// 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";
Index: llvm/tools/bugpoint/BugDriver.h
diff -u llvm/tools/bugpoint/BugDriver.h:1.24 llvm/tools/bugpoint/BugDriver.h:1.25
--- llvm/tools/bugpoint/BugDriver.h:1.24 Wed Feb 18 14:52:02 2004
+++ llvm/tools/bugpoint/BugDriver.h Wed Feb 18 15:02:04 2004
@@ -75,11 +75,16 @@
///
bool run();
- /// debugCrash - This method is called when some pass crashes on input. It
- /// attempts to prune down the testcase to something reasonable, and figure
- /// out exactly which pass is crashing.
+ /// debugOptimizerCrash - This method is called when some optimizer pass
+ /// crashes on input. It attempts to prune down the testcase to something
+ /// reasonable, and figure out exactly which pass is crashing.
///
- bool debugCrash();
+ bool debugOptimizerCrash();
+
+ /// debugCodeGeneratorCrash - This method is called when the code generator
+ /// crashes on an input. It attempts to reduce the input as much as possible
+ /// while still causing the code generator to crash.
+ bool debugCodeGeneratorCrash();
/// debugMiscompilation - This method is used when the passes selected are not
/// crashing, but the generated output is semantically different from the
Index: llvm/tools/bugpoint/CrashDebugger.cpp
diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.27 llvm/tools/bugpoint/CrashDebugger.cpp:1.28
--- llvm/tools/bugpoint/CrashDebugger.cpp:1.27 Tue Jan 13 21:38:37 2004
+++ llvm/tools/bugpoint/CrashDebugger.cpp Wed Feb 18 15:02:04 2004
@@ -257,11 +257,11 @@
return false;
}
-/// debugCrash - This method is called when some pass crashes on input. It
-/// attempts to prune down the testcase to something reasonable, and figure
+/// debugOptimizerCrash - This method is called when some pass crashes on input.
+/// It attempts to prune down the testcase to something reasonable, and figure
/// out exactly which pass is crashing.
///
-bool BugDriver::debugCrash() {
+bool BugDriver::debugOptimizerCrash() {
bool AnyReduction = false;
std::cout << "\n*** Debugging optimizer crash!\n";
@@ -408,3 +408,12 @@
return false;
}
+
+
+/// debugCodeGeneratorCrash - This method is called when the code generator
+/// crashes on an input. It attempts to reduce the input as much as possible
+/// while still causing the code generator to crash.
+bool BugDriver::debugCodeGeneratorCrash() {
+
+ return false;
+}
Index: llvm/tools/bugpoint/Miscompilation.cpp
diff -u llvm/tools/bugpoint/Miscompilation.cpp:1.26 llvm/tools/bugpoint/Miscompilation.cpp:1.27
--- llvm/tools/bugpoint/Miscompilation.cpp:1.26 Tue Jan 13 21:38:37 2004
+++ llvm/tools/bugpoint/Miscompilation.cpp Wed Feb 18 15:02:04 2004
@@ -46,7 +46,7 @@
<< " on the input program!\n";
BD.setPassesToRun(Suffix);
BD.EmitProgressBytecode("pass-error", false);
- exit(BD.debugCrash());
+ exit(BD.debugOptimizerCrash());
}
// Check to see if the finished program matches the reference output...
@@ -74,7 +74,7 @@
<< " on the input program!\n";
BD.setPassesToRun(Prefix);
BD.EmitProgressBytecode("pass-error", false);
- exit(BD.debugCrash());
+ exit(BD.debugOptimizerCrash());
}
// If the prefix maintains the predicate by itself, only keep the prefix!
@@ -107,7 +107,7 @@
<< " on the input program!\n";
BD.setPassesToRun(Suffix);
BD.EmitProgressBytecode("pass-error", false);
- exit(BD.debugCrash());
+ exit(BD.debugOptimizerCrash());
}
// Run the result...
@@ -225,7 +225,7 @@
std::cerr << " Error running this sequence of passes"
<< " on the input program!\n";
BD.EmitProgressBytecode("pass-error", false);
- exit(BD.debugCrash());
+ exit(BD.debugOptimizerCrash());
}
if (!EmitBytecode)
More information about the llvm-commits
mailing list