aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2012-01-31 21:46:17 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2012-01-31 21:46:17 +0000
commit8526e64beffdfadf6b9ab8d4557b2f0851908e57 (patch)
treeb913e675dfe6157f119994979a99aa8d959d5ca3
parent846fe662ba0a532fbf865e317b187802861fca17 (diff)
downloadllvm-8526e64beffdfadf6b9ab8d4557b2f0851908e57.zip
llvm-8526e64beffdfadf6b9ab8d4557b2f0851908e57.tar.gz
llvm-8526e64beffdfadf6b9ab8d4557b2f0851908e57.tar.bz2
Add pretty stack tracing and llvm_shutdown.
llvm-svn: 149428
-rw-r--r--lld/tools/lld-core/lld-core.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lld/tools/lld-core/lld-core.cpp b/lld/tools/lld-core/lld-core.cpp
index 77b6749..7c255b3f 100644
--- a/lld/tools/lld-core/lld-core.cpp
+++ b/lld/tools/lld-core/lld-core.cpp
@@ -23,8 +23,11 @@
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/Signals.h"
#include "llvm/Support/system_error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileSystem.h"
@@ -198,6 +201,11 @@ private:
}
int main(int argc, const char *argv[]) {
+ // Print a stack trace if we signal out.
+ llvm::sys::PrintStackTraceOnErrorSignal();
+ llvm::PrettyStackTraceProgram X(argc, argv);
+ llvm::llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
+
// read input YAML doc into object file(s)
std::vector<File *> files;
if (error(yaml::parseObjectTextFileOrSTDIN(llvm::StringRef(argv[1]), files)))