Make sure to print a stack trace whenever an error signal is delivered to the
tool.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11632 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp
index 2404288..030ffe4 100644
--- a/tools/llvm-ar/llvm-ar.cpp
+++ b/tools/llvm-ar/llvm-ar.cpp
@@ -15,6 +15,7 @@
#include "llvm/Bytecode/Reader.h"
#include "Support/CommandLine.h"
#include "Support/FileUtilities.h"
+#include "Support/Signals.h"
#include <string>
#include <fstream>
#include <cstdio>
@@ -544,9 +545,9 @@
}
int main(int argc, char **argv) {
-
- //Parse Command line options
cl::ParseCommandLineOptions(argc, argv);
+ PrintStackTraceOnErrorSignal();
+
parseCL();
//Create archive!
diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp
index 9be5aff..4b66b78 100644
--- a/tools/llvm-as/llvm-as.cpp
+++ b/tools/llvm-as/llvm-as.cpp
@@ -45,6 +45,7 @@
int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, " llvm .ll -> .bc assembler\n");
+ PrintStackTraceOnErrorSignal();
std::ostream *Out = 0;
try {
diff --git a/tools/llvm-db/llvm-db.cpp b/tools/llvm-db/llvm-db.cpp
index 124db2b..e450520 100644
--- a/tools/llvm-db/llvm-db.cpp
+++ b/tools/llvm-db/llvm-db.cpp
@@ -14,6 +14,7 @@
#include "CLIDebugger.h"
#include "Support/CommandLine.h"
+#include "Support/Signals.h"
#include <iostream>
using namespace llvm;
@@ -51,6 +52,7 @@
int main(int argc, char **argv, char * const *envp) {
cl::ParseCommandLineOptions(argc, argv,
" llvm source-level debugger\n");
+ PrintStackTraceOnErrorSignal();
if (Version || !Quiet) {
std::cout << "llvm-db: The LLVM source-level debugger\n";
diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp
index 6b9c1c2..d9c1751 100644
--- a/tools/llvm-dis/llvm-dis.cpp
+++ b/tools/llvm-dis/llvm-dis.cpp
@@ -53,6 +53,8 @@
int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, " llvm .bc -> .ll disassembler\n");
+ PrintStackTraceOnErrorSignal();
+
std::ostream *Out = &std::cout; // Default to printing to stdout...
std::string ErrorMessage;
diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp
index 1b3dda7..4fe8637 100644
--- a/tools/llvm-link/llvm-link.cpp
+++ b/tools/llvm-link/llvm-link.cpp
@@ -84,6 +84,7 @@
int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, " llvm linker\n");
+ PrintStackTraceOnErrorSignal();
assert(InputFilenames.size() > 0 && "OneOrMore is not working");
unsigned BaseArg = 0;
diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp
index 8678536..c5930e9 100644
--- a/tools/llvm-nm/llvm-nm.cpp
+++ b/tools/llvm-nm/llvm-nm.cpp
@@ -20,6 +20,7 @@
#include "llvm/Bytecode/Reader.h"
#include "Support/CommandLine.h"
#include "Support/FileUtilities.h"
+#include "Support/Signals.h"
#include <cctype>
#include <cstring>
@@ -146,6 +147,8 @@
int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, " llvm symbol table dumper\n");
+ PrintStackTraceOnErrorSignal();
+
ToolName = argv[0];
if (BSDFormat) OutputFormat = bsd;
if (POSIXFormat) OutputFormat = posix;
diff --git a/tools/llvm-prof/llvm-prof.cpp b/tools/llvm-prof/llvm-prof.cpp
index 3c9c390..2a7789d 100644
--- a/tools/llvm-prof/llvm-prof.cpp
+++ b/tools/llvm-prof/llvm-prof.cpp
@@ -18,6 +18,7 @@
#include "llvm/Analysis/ProfileInfoLoader.h"
#include "llvm/Bytecode/Reader.h"
#include "Support/CommandLine.h"
+#include "Support/Signals.h"
#include <cstdio>
#include <map>
#include <set>
@@ -80,6 +81,7 @@
int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, " llvm profile dump decoder\n");
+ PrintStackTraceOnErrorSignal();
// Read in the bytecode file...
std::string ErrorMessage;
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index d032e24..35874b2 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -72,6 +72,7 @@
int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv,
" llvm .bc -> .bc modular optimizer\n");
+ PrintStackTraceOnErrorSignal();
// Allocate a full target machine description only if necessary...
// FIXME: The choice of target should be controllable on the command line.