aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-06-02 04:54:29 +0000
committerChris Lattner <sabre@nondot.org>2003-06-02 04:54:29 +0000
commitb417c795d2a8832b5edac321dc0d19eca7e3f2f5 (patch)
tree39128138ca2144a4f1c5be51e9a4834d6d5b690d
parent24271cf8d78ee4ad181ac0168cf7c2590d40502e (diff)
Remove stupid thinko that was preventing bugpoint from working
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6533 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--tools/bugpoint/CrashDebugger.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp
index fd711d99fc..a0da67ce98 100644
--- a/tools/bugpoint/CrashDebugger.cpp
+++ b/tools/bugpoint/CrashDebugger.cpp
@@ -39,32 +39,37 @@ DebugCrashes::TestResult
DebugCrashes::doTest(std::vector<const PassInfo*> &Prefix,
std::vector<const PassInfo*> &Suffix) {
std::string PrefixOutput;
+ Module *OrigProgram = 0;
if (!Prefix.empty()) {
std::cout << "Checking to see if these passes crash: "
<< getPassesString(Prefix) << ": ";
if (BD.runPasses(Prefix, PrefixOutput))
return KeepPrefix;
+
+ OrigProgram = BD.Program;
+
+ BD.Program = BD.ParseInputFile(PrefixOutput);
+ if (BD.Program == 0) {
+ std::cerr << BD.getToolName() << ": Error reading bytecode file '"
+ << PrefixOutput << "'!\n";
+ exit(1);
+ }
+ removeFile(PrefixOutput);
}
std::cout << "Checking to see if these passes crash: "
<< getPassesString(Suffix) << ": ";
- Module *OrigProgram = BD.Program;
- BD.Program = BD.ParseInputFile(PrefixOutput);
- if (BD.Program == 0) {
- std::cerr << BD.getToolName() << ": Error reading bytecode file '"
- << PrefixOutput << "'!\n";
- exit(1);
- }
- removeFile(PrefixOutput);
-
+
if (BD.runPasses(Suffix)) {
delete OrigProgram; // The suffix crashes alone...
return KeepSuffix;
}
// Nothing failed, restore state...
- delete BD.Program;
- BD.Program = OrigProgram;
+ if (OrigProgram) {
+ delete BD.Program;
+ BD.Program = OrigProgram;
+ }
return NoFailure;
}