summaryrefslogtreecommitdiffstats
path: root/llvm/lib/System/Unix
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-06-16 00:00:57 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-06-16 00:00:57 +0000
commit57e8e38a6fb4bddf8053570ddf909a5504159ce5 (patch)
tree7c697b08d7db46513f9ce06afecd5b0f19bb97ed /llvm/lib/System/Unix
parent4ff6c1646f1c3b17075cf4e5d19fea04a49233c8 (diff)
downloadbcm5719-llvm-57e8e38a6fb4bddf8053570ddf909a5504159ce5.tar.gz
bcm5719-llvm-57e8e38a6fb4bddf8053570ddf909a5504159ce5.zip
Only print the stack trace if it was requested. Previously, any call into
the Signals module that registered the handlers would cause the stack trace to be generated. Now, you must explicitly call PrintStackTraceOnErrorSignal in order for that to happen. llvm-svn: 28810
Diffstat (limited to 'llvm/lib/System/Unix')
-rw-r--r--llvm/lib/System/Unix/Signals.inc6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/System/Unix/Signals.inc b/llvm/lib/System/Unix/Signals.inc
index a643dbf972c..4096ad27273 100644
--- a/llvm/lib/System/Unix/Signals.inc
+++ b/llvm/lib/System/Unix/Signals.inc
@@ -24,6 +24,8 @@
namespace {
+bool StackTraceRequested = false;
+
/// InterruptFunction - The function to call if ctrl-c is pressed.
void (*InterruptFunction)() = 0;
@@ -132,7 +134,8 @@ RETSIGTYPE SignalHandler(int Sig) {
// Otherwise if it is a fault (like SEGV) output the stacktrace to
// STDERR (if we can) and reissue the signal to die...
- PrintStackTrace();
+ if (StackTraceRequested)
+ PrintStackTrace();
signal(Sig, SIG_DFL);
}
@@ -178,6 +181,7 @@ void sys::RemoveDirectoryOnSignal(const llvm::sys::Path& path) {
/// PrintStackTraceOnErrorSignal - When an error signal (such as SIBABRT or
/// SIGSEGV) is delivered to the process, print a stack trace and then exit.
void sys::PrintStackTraceOnErrorSignal() {
+ StackTraceRequested = true;
std::for_each(KillSigs, KillSigsEnd, RegisterHandler);
}
OpenPOWER on IntegriCloud