From 99e68715c7fe0d8f22083fabc2c36ea651ee4171 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 7 Feb 2021 19:04:48 +0100 Subject: [PATCH] Include SIGABRT in crash handling. --- client/TracyProfiler.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 2fa526fa..ca35e39c 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -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