diff options
author | Bartosz Taudul <wolf@nereid.pl> | 2022-10-13 01:14:35 +0300 |
---|---|---|
committer | Bartosz Taudul <wolf@nereid.pl> | 2022-10-13 01:30:17 +0300 |
commit | 6ca1c986557201dab7370cac9f564ba69345f2b0 (patch) | |
tree | 22620ea683c7c771d672fa36177240601bc2caa5 | |
parent | 9657bdec72a94dd6237c65d151d20a0e1dd7dfc6 (diff) |
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).
-rw-r--r-- | public/client/TracyProfiler.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/public/client/TracyProfiler.cpp b/public/client/TracyProfiler.cpp index 2af76b8f..b4eb9572 100644 --- a/public/client/TracyProfiler.cpp +++ b/public/client/TracyProfiler.cpp @@ -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 ); - { - TracyLfqPrepare( QueueType::Crash ); - TracyLfqCommit; - } + 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 |