[llvm-commits] [llvm] r90912 - /llvm/trunk/tools/opt/opt.cpp

Chris Lattner sabre at nondot.org
Tue Dec 8 16:41:28 PST 2009


Author: lattner
Date: Tue Dec  8 18:41:28 2009
New Revision: 90912

URL: http://llvm.org/viewvc/llvm-project?rev=90912&view=rev
Log:
when opt crashes, print its command line arguments as a pretty stack trace.
Somehow opt was missed when this was added.

Modified:
    llvm/trunk/tools/opt/opt.cpp

Modified: llvm/trunk/tools/opt/opt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=90912&r1=90911&r2=90912&view=diff

==============================================================================
--- llvm/trunk/tools/opt/opt.cpp (original)
+++ llvm/trunk/tools/opt/opt.cpp Tue Dec  8 18:41:28 2009
@@ -30,6 +30,7 @@
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/PluginLoader.h"
+#include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/StandardPasses.h"
 #include "llvm/Support/SystemUtils.h"
 #include "llvm/Support/raw_ostream.h"
@@ -340,12 +341,14 @@
 // main for opt
 //
 int main(int argc, char **argv) {
-  llvm_shutdown_obj X;  // Call llvm_shutdown() on exit.
+  sys::PrintStackTraceOnErrorSignal();
+  llvm::PrettyStackTraceProgram X(argc, argv);
+  
+  llvm_shutdown_obj Y;  // Call llvm_shutdown() on exit.
   LLVMContext &Context = getGlobalContext();
   
   cl::ParseCommandLineOptions(argc, argv,
     "llvm .bc -> .bc modular optimizer and analysis printer\n");
-  sys::PrintStackTraceOnErrorSignal();
 
   // Allocate a full target machine description only if necessary.
   // FIXME: The choice of target should be controllable on the command line.





More information about the llvm-commits mailing list