[llvm-commits] [llvm] r66248 - in /llvm/trunk: lib/Transforms/Scalar/JumpThreading.cpp tools/bugpoint/bugpoint.cpp tools/llc/llc.cpp tools/lli/lli.cpp tools/llvm-ar/llvm-ar.cpp tools/llvm-as/llvm-as.cpp tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp tools/llvm-db/llvm-db.cpp tools/llvm-dis/llvm-dis.cpp tools/llvm-extract/llvm-extract.cpp tools/llvm-ld/llvm-ld.cpp tools/llvm-link/llvm-link.cpp tools/llvm-nm/llvm-nm.cpp tools/llvm-prof/llvm-prof.cpp tools/llvm-ranlib/llvm-ranlib.cpp utils/TableGen/TableGen.cpp
Chris Lattner
sabre at nondot.org
Thu Mar 5 21:34:10 PST 2009
Author: lattner
Date: Thu Mar 5 23:34:10 2009
New Revision: 66248
URL: http://llvm.org/viewvc/llvm-project?rev=66248&view=rev
Log:
Change various llvm utilities to use PrettyStackTraceProgram in
their main routines. This makes the tools print their argc/argv
commands if they crash.
Modified:
llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp
llvm/trunk/tools/bugpoint/bugpoint.cpp
llvm/trunk/tools/llc/llc.cpp
llvm/trunk/tools/lli/lli.cpp
llvm/trunk/tools/llvm-ar/llvm-ar.cpp
llvm/trunk/tools/llvm-as/llvm-as.cpp
llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
llvm/trunk/tools/llvm-db/llvm-db.cpp
llvm/trunk/tools/llvm-dis/llvm-dis.cpp
llvm/trunk/tools/llvm-extract/llvm-extract.cpp
llvm/trunk/tools/llvm-ld/llvm-ld.cpp
llvm/trunk/tools/llvm-link/llvm-link.cpp
llvm/trunk/tools/llvm-nm/llvm-nm.cpp
llvm/trunk/tools/llvm-prof/llvm-prof.cpp
llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp
llvm/trunk/utils/TableGen/TableGen.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=66248&r1=66247&r2=66248&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Thu Mar 5 23:34:10 2009
@@ -407,6 +407,12 @@
return true;
}
+struct APIntUnsignedOrdering {
+ bool operator()(const APInt &LHS, const APInt &RHS) const {
+ return LHS.ult(RHS);
+ }
+};
+
/// ProcessSwitchOnDuplicateCond - We found a block and a predecessor of that
/// block that switch on exactly the same condition. This means that we almost
/// always know the direction of the edge in the DESTBB:
@@ -474,6 +480,34 @@
return true;
}
+#if 0
+ // Figure out on which of the condition allow us to get to DESTBB. If DESTBB
+ // is the default label, we compute the set of values COND is known not to be
+ // otherwise we compute the set of options that COND could be.
+ SmallVector<APInt, 16> KnownValues;
+ bool DestBBIsDefault = PredSI->getSuccessor(0) == DestBB;
+
+ if (DestBBIsDefault) {
+ // DestBB the default case. Collect the values where PredBB can't branch to
+ // DestBB.
+ for (unsigned i = 1/*skip default*/, e = PredSI->getNumCases(); i != e; ++i)
+ if (PredSI->getSuccessor(i) != DestBB)
+ KnownValues.push_back(PredSI->getCaseValue(i)->getValue());
+ } else {
+ // Not the default case. Collect the values where PredBB can branch to
+ // DestBB.
+ for (unsigned i = 1/*skip default*/, e = PredSI->getNumCases(); i != e; ++i)
+ if (PredSI->getSuccessor(i) == DestBB)
+ KnownValues.push_back(PredSI->getCaseValue(i)->getValue());
+ }
+
+ std::sort(KnownValues.begin(), KnownValues.end(), APIntUnsignedOrdering());
+ return false;
+ cerr << "\nFOUND THREAD BLOCKS:\n";
+ PredBB->dump();
+ DestBB->dump();
+#endif
+
return false;
}
Modified: llvm/trunk/tools/bugpoint/bugpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/bugpoint.cpp?rev=66248&r1=66247&r2=66248&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/bugpoint.cpp (original)
+++ llvm/trunk/tools/bugpoint/bugpoint.cpp Thu Mar 5 23:34:10 2009
@@ -20,6 +20,7 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/PluginLoader.h"
+#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/System/Process.h"
#include "llvm/System/Signals.h"
#include "llvm/LinkAllVMCore.h"
@@ -64,12 +65,13 @@
}
int main(int argc, char **argv) {
- llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
+ llvm::sys::PrintStackTraceOnErrorSignal();
+ llvm::PrettyStackTraceProgram X(argc, argv);
+ llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
cl::ParseCommandLineOptions(argc, argv,
"LLVM automatic testcase reducer. See\nhttp://"
"llvm.org/cmds/bugpoint.html"
" for more information.\n");
- sys::PrintStackTraceOnErrorSignal();
sys::SetInterruptFunction(BugpointInterruptFunction);
BugDriver D(argv[0], AsChild, FindBugs, TimeoutValue, MemoryLimit);
Modified: llvm/trunk/tools/llc/llc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/llc.cpp?rev=66248&r1=66247&r2=66248&view=diff
==============================================================================
--- llvm/trunk/tools/llc/llc.cpp (original)
+++ llvm/trunk/tools/llc/llc.cpp Thu Mar 5 23:34:10 2009
@@ -31,6 +31,7 @@
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/PluginLoader.h"
+#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/RegistryParser.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Analysis/Verifier.h"
@@ -192,9 +193,10 @@
// main - Entry point for the llc compiler.
//
int main(int argc, char **argv) {
- llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
- cl::ParseCommandLineOptions(argc, argv, "llvm system compiler\n");
sys::PrintStackTraceOnErrorSignal();
+ PrettyStackTraceProgram X(argc, argv);
+ llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
+ cl::ParseCommandLineOptions(argc, argv, "llvm system compiler\n");
// Load the module to be compiled...
std::string ErrorMessage;
Modified: llvm/trunk/tools/lli/lli.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/lli.cpp?rev=66248&r1=66247&r2=66248&view=diff
==============================================================================
--- llvm/trunk/tools/lli/lli.cpp (original)
+++ llvm/trunk/tools/lli/lli.cpp Thu Mar 5 23:34:10 2009
@@ -25,6 +25,7 @@
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/PluginLoader.h"
+#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/System/Process.h"
#include "llvm/System/Signals.h"
#include <iostream>
@@ -83,10 +84,12 @@
// main Driver function
//
int main(int argc, char **argv, char * const *envp) {
+ sys::PrintStackTraceOnErrorSignal();
+ PrettyStackTraceProgram X(argc, argv);
+
atexit(do_shutdown); // Call llvm_shutdown() on exit.
cl::ParseCommandLineOptions(argc, argv,
"llvm interpreter & dynamic compiler\n");
- sys::PrintStackTraceOnErrorSignal();
// If the user doesn't want core files, disable them.
if (DisableCoreFiles)
Modified: llvm/trunk/tools/llvm-ar/llvm-ar.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/llvm-ar.cpp?rev=66248&r1=66247&r2=66248&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-ar/llvm-ar.cpp (original)
+++ llvm/trunk/tools/llvm-ar/llvm-ar.cpp Thu Mar 5 23:34:10 2009
@@ -16,6 +16,7 @@
#include "llvm/Bitcode/Archive.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/System/Signals.h"
#include <iostream>
#include <algorithm>
@@ -686,7 +687,10 @@
// main - main program for llvm-ar .. see comments in the code
int main(int argc, char **argv) {
- llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
+ // Print a stack trace if we signal out.
+ sys::PrintStackTraceOnErrorSignal();
+ PrettyStackTraceProgram X(argc, argv);
+ llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
// Have the command line options parsed and handle things
// like --help and --version.
@@ -695,9 +699,6 @@
" This program archives bitcode files into single libraries\n"
);
- // Print a stack trace if we signal out.
- sys::PrintStackTraceOnErrorSignal();
-
int exitCode = 0;
// Make sure we don't exit with "unhandled exception".
Modified: llvm/trunk/tools/llvm-as/llvm-as.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-as/llvm-as.cpp?rev=66248&r1=66247&r2=66248&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-as/llvm-as.cpp (original)
+++ llvm/trunk/tools/llvm-as/llvm-as.cpp Thu Mar 5 23:34:10 2009
@@ -21,6 +21,7 @@
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Streams.h"
#include "llvm/Support/SystemUtils.h"
#include "llvm/Support/raw_ostream.h"
@@ -51,9 +52,11 @@
cl::desc("Do not run verifier on input LLVM (dangerous!)"));
int main(int argc, char **argv) {
- llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
- cl::ParseCommandLineOptions(argc, argv, "llvm .ll -> .bc assembler\n");
+ // Print a stack trace if we signal out.
sys::PrintStackTraceOnErrorSignal();
+ PrettyStackTraceProgram X(argc, argv);
+ llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
+ cl::ParseCommandLineOptions(argc, argv, "llvm .ll -> .bc assembler\n");
int exitCode = 0;
std::ostream *Out = 0;
Modified: llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp?rev=66248&r1=66247&r2=66248&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp (original)
+++ llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Thu Mar 5 23:34:10 2009
@@ -33,6 +33,7 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/System/Signals.h"
#include <map>
#include <fstream>
@@ -501,10 +502,11 @@
int main(int argc, char **argv) {
- llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
- cl::ParseCommandLineOptions(argc, argv, "llvm-bcanalyzer file analyzer\n");
-
+ // Print a stack trace if we signal out.
sys::PrintStackTraceOnErrorSignal();
+ PrettyStackTraceProgram X(argc, argv);
+ llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
+ cl::ParseCommandLineOptions(argc, argv, "llvm-bcanalyzer file analyzer\n");
return AnalyzeBitcode();
}
Modified: llvm/trunk/tools/llvm-db/llvm-db.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-db/llvm-db.cpp?rev=66248&r1=66247&r2=66248&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-db/llvm-db.cpp (original)
+++ llvm/trunk/tools/llvm-db/llvm-db.cpp Thu Mar 5 23:34:10 2009
@@ -15,6 +15,7 @@
#include "CLIDebugger.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/System/Signals.h"
#include <iostream>
using namespace llvm;
@@ -49,12 +50,15 @@
// main Driver function
//
int main(int argc, char **argv, char * const *envp) {
- llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
+ // Print a stack trace if we signal out.
+ sys::PrintStackTraceOnErrorSignal();
+ PrettyStackTraceProgram X(argc, argv);
+
+ llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
std::cout << "NOTE: llvm-db is known useless right now.\n";
try {
cl::ParseCommandLineOptions(argc, argv,
"llvm source-level debugger\n");
- sys::PrintStackTraceOnErrorSignal();
if (!Quiet)
std::cout << "llvm-db: The LLVM source-level debugger\n";
Modified: llvm/trunk/tools/llvm-dis/llvm-dis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dis/llvm-dis.cpp?rev=66248&r1=66247&r2=66248&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-dis/llvm-dis.cpp (original)
+++ llvm/trunk/tools/llvm-dis/llvm-dis.cpp Thu Mar 5 23:34:10 2009
@@ -23,6 +23,7 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Streams.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Signals.h"
@@ -45,10 +46,13 @@
DontPrint("disable-output", cl::desc("Don't output the .ll file"), cl::Hidden);
int main(int argc, char **argv) {
- llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
+ // Print a stack trace if we signal out.
+ sys::PrintStackTraceOnErrorSignal();
+ PrettyStackTraceProgram X(argc, argv);
+
+ llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
try {
cl::ParseCommandLineOptions(argc, argv, "llvm .bc -> .ll disassembler\n");
- sys::PrintStackTraceOnErrorSignal();
std::ostream *Out = &std::cout; // Default to printing to stdout.
std::string ErrorMessage;
Modified: llvm/trunk/tools/llvm-extract/llvm-extract.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-extract/llvm-extract.cpp?rev=66248&r1=66247&r2=66248&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-extract/llvm-extract.cpp (original)
+++ llvm/trunk/tools/llvm-extract/llvm-extract.cpp Thu Mar 5 23:34:10 2009
@@ -20,6 +20,7 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/System/Signals.h"
#include <iostream>
#include <memory>
@@ -56,9 +57,12 @@
cl::value_desc("global"));
int main(int argc, char **argv) {
- llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
- cl::ParseCommandLineOptions(argc, argv, "llvm extractor\n");
+ // Print a stack trace if we signal out.
sys::PrintStackTraceOnErrorSignal();
+ PrettyStackTraceProgram X(argc, argv);
+
+ llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
+ cl::ParseCommandLineOptions(argc, argv, "llvm extractor\n");
std::auto_ptr<Module> M;
Modified: llvm/trunk/tools/llvm-ld/llvm-ld.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ld/llvm-ld.cpp?rev=66248&r1=66247&r2=66248&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-ld/llvm-ld.cpp (original)
+++ llvm/trunk/tools/llvm-ld/llvm-ld.cpp Thu Mar 5 23:34:10 2009
@@ -33,6 +33,7 @@
#include "llvm/Support/FileUtilities.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Streams.h"
#include "llvm/Support/SystemUtils.h"
#include "llvm/System/Signals.h"
@@ -501,14 +502,17 @@
}
int main(int argc, char **argv, char **envp) {
- llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
+ // Print a stack trace if we signal out.
+ sys::PrintStackTraceOnErrorSignal();
+ PrettyStackTraceProgram X(argc, argv);
+
+ llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
try {
// Initial global variable above for convenience printing of program name.
progname = sys::Path(argv[0]).getBasename();
// Parse the command line options
cl::ParseCommandLineOptions(argc, argv, "llvm linker\n");
- sys::PrintStackTraceOnErrorSignal();
// Construct a Linker (now that Verbose is set)
Linker TheLinker(progname, OutputFilename, Verbose);
Modified: llvm/trunk/tools/llvm-link/llvm-link.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-link/llvm-link.cpp?rev=66248&r1=66247&r2=66248&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-link/llvm-link.cpp (original)
+++ llvm/trunk/tools/llvm-link/llvm-link.cpp Thu Mar 5 23:34:10 2009
@@ -19,6 +19,7 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Streams.h"
#include "llvm/System/Signals.h"
#include "llvm/System/Path.h"
@@ -79,10 +80,12 @@
}
int main(int argc, char **argv) {
- llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
- cl::ParseCommandLineOptions(argc, argv, "llvm linker\n");
+ // Print a stack trace if we signal out.
sys::PrintStackTraceOnErrorSignal();
- assert(InputFilenames.size() > 0 && "OneOrMore is not working");
+ PrettyStackTraceProgram X(argc, argv);
+
+ llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
+ cl::ParseCommandLineOptions(argc, argv, "llvm linker\n");
unsigned BaseArg = 0;
std::string ErrorMessage;
Modified: llvm/trunk/tools/llvm-nm/llvm-nm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-nm/llvm-nm.cpp?rev=66248&r1=66247&r2=66248&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-nm/llvm-nm.cpp (original)
+++ llvm/trunk/tools/llvm-nm/llvm-nm.cpp Thu Mar 5 23:34:10 2009
@@ -22,6 +22,7 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/System/Signals.h"
#include <algorithm>
#include <cctype>
@@ -166,9 +167,12 @@
}
int main(int argc, char **argv) {
- llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
- cl::ParseCommandLineOptions(argc, argv, "llvm symbol table dumper\n");
+ // Print a stack trace if we signal out.
sys::PrintStackTraceOnErrorSignal();
+ PrettyStackTraceProgram X(argc, argv);
+
+ llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
+ cl::ParseCommandLineOptions(argc, argv, "llvm symbol table dumper\n");
ToolName = argv[0];
if (BSDFormat) OutputFormat = bsd;
Modified: llvm/trunk/tools/llvm-prof/llvm-prof.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-prof/llvm-prof.cpp?rev=66248&r1=66247&r2=66248&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-prof/llvm-prof.cpp (original)
+++ llvm/trunk/tools/llvm-prof/llvm-prof.cpp Thu Mar 5 23:34:10 2009
@@ -21,6 +21,7 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Signals.h"
#include <algorithm>
@@ -111,10 +112,13 @@
int main(int argc, char **argv) {
- llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
+ // Print a stack trace if we signal out.
+ sys::PrintStackTraceOnErrorSignal();
+ PrettyStackTraceProgram X(argc, argv);
+
+ llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
try {
cl::ParseCommandLineOptions(argc, argv, "llvm profile dump decoder\n");
- sys::PrintStackTraceOnErrorSignal();
// Read in the bitcode file...
std::string ErrorMessage;
Modified: llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp?rev=66248&r1=66247&r2=66248&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp (original)
+++ llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp Thu Mar 5 23:34:10 2009
@@ -15,6 +15,7 @@
#include "llvm/Bitcode/Archive.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/System/Signals.h"
#include <iostream>
#include <iomanip>
@@ -42,7 +43,11 @@
}
int main(int argc, char **argv) {
- llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
+ // Print a stack trace if we signal out.
+ llvm::sys::PrintStackTraceOnErrorSignal();
+ llvm::PrettyStackTraceProgram X(argc, argv);
+
+ llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
// Have the command line options parsed and handle things
// like --help and --version.
@@ -52,9 +57,6 @@
" to an LLVM archive file."
);
- // Print a stack trace if we signal out.
- sys::PrintStackTraceOnErrorSignal();
-
int exitCode = 0;
// Make sure we don't exit with "unhandled exception".
Modified: llvm/trunk/utils/TableGen/TableGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TableGen.cpp?rev=66248&r1=66247&r2=66248&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/TableGen.cpp (original)
+++ llvm/trunk/utils/TableGen/TableGen.cpp Thu Mar 5 23:34:10 2009
@@ -22,6 +22,7 @@
#include "llvm/System/Signals.h"
#include "llvm/Support/FileUtilities.h"
#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/PrettyStackTrace.h"
#include "CallingConvEmitter.h"
#include "CodeEmitterGen.h"
#include "RegisterInfoEmitter.h"
@@ -130,6 +131,8 @@
}
int main(int argc, char **argv) {
+ sys::PrintStackTraceOnErrorSignal();
+ PrettyStackTraceProgram X(argc, argv);
cl::ParseCommandLineOptions(argc, argv);
// Parse the input file.
More information about the llvm-commits
mailing list