mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-02 00:36:36 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28810 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
44500e3d53
commit
dc6830ff25
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user