mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-14 20:14:35 +00:00
Use SetUnhandledExceptionFilter instead of vectored exceptions
This commit is contained in:
parent
9378718231
commit
5213c53bb0
@ -1501,13 +1501,16 @@ void Profiler::InstallCrashHandler()
|
|||||||
sigaction( SIGPIPE, &crashHandler, &m_prevSignal.pipe );
|
sigaction( SIGPIPE, &crashHandler, &m_prevSignal.pipe );
|
||||||
sigaction( SIGBUS, &crashHandler, &m_prevSignal.bus );
|
sigaction( SIGBUS, &crashHandler, &m_prevSignal.bus );
|
||||||
sigaction( SIGABRT, &crashHandler, &m_prevSignal.abrt );
|
sigaction( SIGABRT, &crashHandler, &m_prevSignal.abrt );
|
||||||
|
|
||||||
|
m_crashHandlerInstalled = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined _WIN32 && !defined TRACY_UWP && !defined TRACY_NO_CRASH_HANDLER
|
#if defined _WIN32 && !defined TRACY_UWP && !defined TRACY_NO_CRASH_HANDLER
|
||||||
m_exceptionHandler = AddVectoredExceptionHandler( 0, CrashFilter );
|
// We cannot use Vectored Exception handling because it catches application-wide frame-based SEH blocks. We only
|
||||||
#endif
|
// want to catch unhandled exceptions in the event that there is not already an unhandled exception filter.
|
||||||
|
if( auto prev = SetUnhandledExceptionFilter( CrashFilter ) )
|
||||||
#ifndef TRACY_NO_CRASH_HANDLER
|
SetUnhandledExceptionFilter( prev ); // Already had a handler => put it back
|
||||||
|
else
|
||||||
m_crashHandlerInstalled = true;
|
m_crashHandlerInstalled = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1516,7 +1519,12 @@ void Profiler::InstallCrashHandler()
|
|||||||
void Profiler::RemoveCrashHandler()
|
void Profiler::RemoveCrashHandler()
|
||||||
{
|
{
|
||||||
#if defined _WIN32 && !defined TRACY_UWP
|
#if defined _WIN32 && !defined TRACY_UWP
|
||||||
if( m_crashHandlerInstalled ) RemoveVectoredExceptionHandler( m_exceptionHandler );
|
if( m_crashHandlerInstalled )
|
||||||
|
{
|
||||||
|
auto prev = SetUnhandledExceptionFilter( NULL );
|
||||||
|
if( prev != CrashFilter )
|
||||||
|
SetUnhandledExceptionFilter( prev ); // A different exception filter was installed over ours => put it back
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined __linux__ && !defined TRACY_NO_CRASH_HANDLER
|
#if defined __linux__ && !defined TRACY_NO_CRASH_HANDLER
|
||||||
|
@ -1063,9 +1063,7 @@ private:
|
|||||||
char* m_safeSendBuffer;
|
char* m_safeSendBuffer;
|
||||||
size_t m_safeSendBufferSize;
|
size_t m_safeSendBufferSize;
|
||||||
|
|
||||||
#if defined _WIN32
|
#ifndef _WIN32
|
||||||
void* m_exceptionHandler;
|
|
||||||
#else
|
|
||||||
int m_pipe[2];
|
int m_pipe[2];
|
||||||
int m_pipeBufSize;
|
int m_pipeBufSize;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user