[llvm-commits] CVS: llvm/tools/bugpoint/CrashDebugger.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Jun 1 23:55:01 PDT 2003


Changes in directory llvm/tools/bugpoint:

CrashDebugger.cpp updated: 1.9 -> 1.10

---
Log message:

Remove stupid thinko that was preventing bugpoint from working


---
Diffs of the changes:

Index: llvm/tools/bugpoint/CrashDebugger.cpp
diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.9 llvm/tools/bugpoint/CrashDebugger.cpp:1.10
--- llvm/tools/bugpoint/CrashDebugger.cpp:1.9	Thu Apr 24 19:53:05 2003
+++ llvm/tools/bugpoint/CrashDebugger.cpp	Sun Jun  1 23:54:29 2003
@@ -39,32 +39,37 @@
 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;
 }
 





More information about the llvm-commits mailing list