mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 12:23:53 +00:00
Restore original signal handlers on profiler exit.
This commit is contained in:
parent
5936e7c86c
commit
54fa21bcbb
@ -1236,17 +1236,17 @@ void Profiler::SpawnWorkerThreads()
|
||||
#ifdef __linux__
|
||||
struct sigaction threadFreezer = {};
|
||||
threadFreezer.sa_handler = ThreadFreezer;
|
||||
sigaction( SIGPWR, &threadFreezer, nullptr );
|
||||
sigaction( SIGPWR, &threadFreezer, &m_prevSignal.pwr );
|
||||
|
||||
struct sigaction crashHandler = {};
|
||||
crashHandler.sa_sigaction = CrashHandler;
|
||||
crashHandler.sa_flags = SA_SIGINFO;
|
||||
sigaction( SIGILL, &crashHandler, nullptr );
|
||||
sigaction( SIGFPE, &crashHandler, nullptr );
|
||||
sigaction( SIGSEGV, &crashHandler, nullptr );
|
||||
sigaction( SIGPIPE, &crashHandler, nullptr );
|
||||
sigaction( SIGBUS, &crashHandler, nullptr );
|
||||
sigaction( SIGABRT, &crashHandler, nullptr );
|
||||
sigaction( SIGILL, &crashHandler, &m_prevSignal.ill );
|
||||
sigaction( SIGFPE, &crashHandler, &m_prevSignal.fpe );
|
||||
sigaction( SIGSEGV, &crashHandler, &m_prevSignal.segv );
|
||||
sigaction( SIGPIPE, &crashHandler, &m_prevSignal.pipe );
|
||||
sigaction( SIGBUS, &crashHandler, &m_prevSignal.bus );
|
||||
sigaction( SIGABRT, &crashHandler, &m_prevSignal.abrt );
|
||||
#endif
|
||||
|
||||
#ifdef TRACY_HAS_CALLSTACK
|
||||
@ -1260,6 +1260,16 @@ Profiler::~Profiler()
|
||||
{
|
||||
m_shutdown.store( true, std::memory_order_relaxed );
|
||||
|
||||
#ifdef __linux__
|
||||
sigaction( SIGPWR, &m_prevSignal.pwr, nullptr );
|
||||
sigaction( SIGILL, &m_prevSignal.ill, nullptr );
|
||||
sigaction( SIGFPE, &m_prevSignal.fpe, nullptr );
|
||||
sigaction( SIGSEGV, &m_prevSignal.segv, nullptr );
|
||||
sigaction( SIGPIPE, &m_prevSignal.pipe, nullptr );
|
||||
sigaction( SIGBUS, &m_prevSignal.bus, nullptr );
|
||||
sigaction( SIGABRT, &m_prevSignal.abrt, nullptr );
|
||||
#endif
|
||||
|
||||
#ifdef TRACY_HAS_SYSTEM_TRACING
|
||||
if( s_sysTraceThread )
|
||||
{
|
||||
|
@ -811,6 +811,12 @@ private:
|
||||
|
||||
char* m_queryData;
|
||||
char* m_queryDataPtr;
|
||||
|
||||
#ifdef __linux__
|
||||
struct {
|
||||
struct sigaction pwr, ill, fpe, segv, pipe, bus, abrt;
|
||||
} m_prevSignal;
|
||||
#endif
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user