[llvm-commits] CVS: llvm/lib/System/Unix/Signals.inc

Reid Spencer reid at x10sys.com
Thu Jun 15 17:01:10 PDT 2006



Changes in directory llvm/lib/System/Unix:

Signals.inc updated: 1.10 -> 1.11
---
Log message:

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.


---
Diffs of the changes:  (+5 -1)

 Signals.inc |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletion(-)


Index: llvm/lib/System/Unix/Signals.inc
diff -u llvm/lib/System/Unix/Signals.inc:1.10 llvm/lib/System/Unix/Signals.inc:1.11
--- llvm/lib/System/Unix/Signals.inc:1.10	Mon Aug  1 21:14:22 2005
+++ llvm/lib/System/Unix/Signals.inc	Thu Jun 15 19:00:57 2006
@@ -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 @@
 
   // 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 @@
 /// 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);
 }
 






More information about the llvm-commits mailing list