1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-30 04:43:53 +00:00

Add flag to disable crash handler

This commit is contained in:
Blake Taylor 2022-04-26 21:19:56 -07:00
parent afd4cdec63
commit 5fb8b38f3a

View File

@ -738,7 +738,7 @@ static BroadcastMessage& GetBroadcastMessage( const char* procname, size_t pnsz,
return msg; return msg;
} }
#if defined _WIN32 && !defined TRACY_UWP #if defined _WIN32 && !defined TRACY_UWP && !defined TRACY_NO_CRASH_HANDLER
static DWORD s_profilerThreadId = 0; static DWORD s_profilerThreadId = 0;
static char s_crashText[1024]; static char s_crashText[1024];
@ -847,7 +847,7 @@ LONG WINAPI CrashFilter( PEXCEPTION_POINTERS pExp )
} }
#endif #endif
#ifdef __linux__ #ifdef __linux__ && !defined TRACY_NO_CRASH_HANDLER
# ifndef TRACY_CRASH_SIGNAL # ifndef TRACY_CRASH_SIGNAL
# define TRACY_CRASH_SIGNAL SIGPWR # define TRACY_CRASH_SIGNAL SIGPWR
# endif # endif
@ -1416,12 +1416,12 @@ void Profiler::SpawnWorkerThreads()
new(s_symbolThread) Thread( LaunchSymbolWorker, this ); new(s_symbolThread) Thread( LaunchSymbolWorker, this );
#endif #endif
#if defined _WIN32 && !defined TRACY_UWP #if defined _WIN32 && !defined TRACY_UWP && !defined TRACY_NO_CRASH_HANDLER
s_profilerThreadId = GetThreadId( s_thread->Handle() ); s_profilerThreadId = GetThreadId( s_thread->Handle() );
m_exceptionHandler = AddVectoredExceptionHandler( 1, CrashFilter ); m_exceptionHandler = AddVectoredExceptionHandler( 1, CrashFilter );
#endif #endif
#ifdef __linux__ #if defined __linux__ && !defined TRACY_NO_CRASH_HANDLER
struct sigaction threadFreezer = {}; struct sigaction threadFreezer = {};
threadFreezer.sa_handler = ThreadFreezer; threadFreezer.sa_handler = ThreadFreezer;
sigaction( TRACY_CRASH_SIGNAL, &threadFreezer, &m_prevSignal.pwr ); sigaction( TRACY_CRASH_SIGNAL, &threadFreezer, &m_prevSignal.pwr );
@ -1437,7 +1437,9 @@ void Profiler::SpawnWorkerThreads()
sigaction( SIGABRT, &crashHandler, &m_prevSignal.abrt ); sigaction( SIGABRT, &crashHandler, &m_prevSignal.abrt );
#endif #endif
#ifndef TRACY_NO_CRASH_HANDLER
m_crashHandlerInstalled = true; m_crashHandlerInstalled = true;
#endif
#ifdef TRACY_HAS_CALLSTACK #ifdef TRACY_HAS_CALLSTACK
InitCallstack(); InitCallstack();