Handle symbol thread crashes.

Should the symbol thread crash, mark that it is gone. This will allow the
profiler to transmit crash call stack, including resolved symbol names and
locations (which will resolve on the main profiler thread).
This commit is contained in:
Bartosz Taudul 2022-10-13 00:14:35 +02:00
parent 9657bdec72
commit 6ca1c98655
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -849,6 +849,19 @@ LONG WINAPI CrashFilter( PEXCEPTION_POINTERS pExp )
}
#endif
static Profiler* s_instance = nullptr;
static Thread* s_thread;
#ifndef TRACY_NO_FRAME_IMAGE
static Thread* s_compressThread;
#endif
#ifdef TRACY_HAS_CALLSTACK
static Thread* s_symbolThread;
std::atomic<bool> s_symbolThreadGone { false };
#endif
#ifdef TRACY_HAS_SYSTEM_TRACING
static Thread* s_sysTraceThread = nullptr;
#endif
#if defined __linux__ && !defined TRACY_NO_CRASH_HANDLER
# ifndef TRACY_CRASH_SIGNAL
# define TRACY_CRASH_SIGNAL SIGPWR
@ -1067,10 +1080,10 @@ static void CrashHandler( int signal, siginfo_t* info, void* /*ucontext*/ )
}
closedir( dp );
{
if( selfTid == s_symbolTid ) s_symbolThreadGone.store( true, std::memory_order_release );
TracyLfqPrepare( QueueType::Crash );
TracyLfqCommit;
}
std::this_thread::sleep_for( std::chrono::milliseconds( 500 ) );
GetProfiler().RequestShutdown();
@ -1083,19 +1096,6 @@ static void CrashHandler( int signal, siginfo_t* info, void* /*ucontext*/ )
enum { QueuePrealloc = 256 * 1024 };
static Profiler* s_instance = nullptr;
static Thread* s_thread;
#ifndef TRACY_NO_FRAME_IMAGE
static Thread* s_compressThread;
#endif
#ifdef TRACY_HAS_CALLSTACK
static Thread* s_symbolThread;
std::atomic<bool> s_symbolThreadGone { false };
#endif
#ifdef TRACY_HAS_SYSTEM_TRACING
static Thread* s_sysTraceThread = nullptr;
#endif
TRACY_API int64_t GetFrequencyQpc()
{
#if defined _WIN32