Include SIGABRT in crash handling.

This commit is contained in:
Bartosz Taudul 2021-02-07 19:04:48 +01:00
parent c220177828
commit 99e68715c7

View File

@ -746,6 +746,10 @@ static void CrashHandler( int signal, siginfo_t* info, void* /*ucontext*/ )
bool expected = false;
if( !s_alreadyCrashed.compare_exchange_strong( expected, true ) ) ThreadFreezer( signal );
struct sigaction act = {};
act.sa_handler = SIG_DFL;
sigaction( SIGABRT, &act, nullptr );
auto msgPtr = s_crashText;
switch( signal )
{
@ -872,6 +876,9 @@ static void CrashHandler( int signal, siginfo_t* info, void* /*ucontext*/ )
break;
}
break;
case SIGABRT:
strcpy( msgPtr, "Abort signal from abort().\n" );
break;
default:
abort();
}
@ -1221,6 +1228,7 @@ void Profiler::SpawnWorkerThreads()
sigaction( SIGSEGV, &crashHandler, nullptr );
sigaction( SIGPIPE, &crashHandler, nullptr );
sigaction( SIGBUS, &crashHandler, nullptr );
sigaction( SIGABRT, &crashHandler, nullptr );
#endif
#ifdef TRACY_HAS_CALLSTACK