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

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


Changes in directory llvm/tools/bugpoint:

OptimizerDriver.cpp updated: 1.6 -> 1.7

---
Log message:

Give better information about how the passes crash


---
Diffs of the changes:

Index: llvm/tools/bugpoint/OptimizerDriver.cpp
diff -u llvm/tools/bugpoint/OptimizerDriver.cpp:1.6 llvm/tools/bugpoint/OptimizerDriver.cpp:1.7
--- llvm/tools/bugpoint/OptimizerDriver.cpp:1.6	Thu Apr 24 14:10:06 2003
+++ llvm/tools/bugpoint/OptimizerDriver.cpp	Sun Jun  1 23:54:16 2003
@@ -133,8 +133,23 @@
   if (DeleteOutput)
     removeFile(OutputFilename);
 
-  if (!Quiet) std::cout << (Status ? "Crashed!\n" : "Success!\n");
+  bool ExitedOK = WIFEXITED(Status) && WEXITSTATUS(Status) == 0;
+  
+  if (!Quiet) {
+    if (ExitedOK)
+      std::cout << "Success!\n";
+    else if (WIFEXITED(Status))
+      std::cout << "Exited with error code '" << WEXITSTATUS(Status) << "'\n";
+    else if (WIFSIGNALED(Status))
+      std::cout << "Crashed with signal #" << WTERMSIG(Status) << "\n";
+#ifdef WCOREDUMP
+    else if (WCOREDUMP(Status))
+      std::cout << "Dumped core\n";
+#endif
+    else
+      std::cout << "Failed for unknown reason!\n";
+  }
 
   // Was the child successful?
-  return Status != 0;
+  return !ExitedOK;
 }





More information about the llvm-commits mailing list