mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-23 06:44:35 +00:00
Send crash report.
This commit is contained in:
parent
49e36c013f
commit
3b526b074e
@ -357,7 +357,20 @@ LONG WINAPI CrashFilter( PEXCEPTION_POINTERS pExp )
|
|||||||
return EXCEPTION_CONTINUE_SEARCH;
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
Profiler::Message( "!!!CRASH!!!" );
|
{
|
||||||
|
const auto thread = GetThreadHandle();
|
||||||
|
Magic magic;
|
||||||
|
auto& token = s_token.ptr;
|
||||||
|
auto& tail = token->get_tail_index();
|
||||||
|
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||||
|
MemWrite( &item->hdr.type, QueueType::CrashReport );
|
||||||
|
item->crashReport.time = Profiler::GetTime();
|
||||||
|
item->crashReport.thread = thread;
|
||||||
|
item->crashReport.text = (uint64_t)s_crashText;
|
||||||
|
tail.store( magic + 1, std::memory_order_release );
|
||||||
|
|
||||||
|
s_profiler.SendCallstack( 60, thread );
|
||||||
|
}
|
||||||
|
|
||||||
HANDLE h = CreateToolhelp32Snapshot( TH32CS_SNAPTHREAD, 0 );
|
HANDLE h = CreateToolhelp32Snapshot( TH32CS_SNAPTHREAD, 0 );
|
||||||
if( h == INVALID_HANDLE_VALUE ) return EXCEPTION_CONTINUE_SEARCH;
|
if( h == INVALID_HANDLE_VALUE ) return EXCEPTION_CONTINUE_SEARCH;
|
||||||
|
@ -17,6 +17,7 @@ enum class QueueType : uint8_t
|
|||||||
Terminate,
|
Terminate,
|
||||||
KeepAlive,
|
KeepAlive,
|
||||||
Crash,
|
Crash,
|
||||||
|
CrashReport,
|
||||||
ZoneBegin,
|
ZoneBegin,
|
||||||
ZoneBeginCallstack,
|
ZoneBeginCallstack,
|
||||||
ZoneEnd,
|
ZoneEnd,
|
||||||
@ -235,6 +236,13 @@ struct QueueCallstackFrame
|
|||||||
uint32_t line;
|
uint32_t line;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct QueueCrashReport
|
||||||
|
{
|
||||||
|
int64_t time;
|
||||||
|
uint64_t thread;
|
||||||
|
uint64_t text; // ptr
|
||||||
|
};
|
||||||
|
|
||||||
struct QueueHeader
|
struct QueueHeader
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
@ -271,6 +279,7 @@ struct QueueItem
|
|||||||
QueueCallstackMemory callstackMemory;
|
QueueCallstackMemory callstackMemory;
|
||||||
QueueCallstack callstack;
|
QueueCallstack callstack;
|
||||||
QueueCallstackFrame callstackFrame;
|
QueueCallstackFrame callstackFrame;
|
||||||
|
QueueCrashReport crashReport;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -289,6 +298,7 @@ static const size_t QueueDataSize[] = {
|
|||||||
sizeof( QueueHeader ), // terminate
|
sizeof( QueueHeader ), // terminate
|
||||||
sizeof( QueueHeader ), // keep alive
|
sizeof( QueueHeader ), // keep alive
|
||||||
sizeof( QueueHeader ), // crash
|
sizeof( QueueHeader ), // crash
|
||||||
|
sizeof( QueueHeader ) + sizeof( QueueCrashReport ),
|
||||||
sizeof( QueueHeader ) + sizeof( QueueZoneBegin ),
|
sizeof( QueueHeader ) + sizeof( QueueZoneBegin ),
|
||||||
sizeof( QueueHeader ) + sizeof( QueueZoneBegin ), // callstack
|
sizeof( QueueHeader ) + sizeof( QueueZoneBegin ), // callstack
|
||||||
sizeof( QueueHeader ) + sizeof( QueueZoneEnd ),
|
sizeof( QueueHeader ) + sizeof( QueueZoneEnd ),
|
||||||
|
@ -181,6 +181,17 @@ struct CallstackFrameTree
|
|||||||
|
|
||||||
enum { CallstackFrameTreeSize = sizeof( CallstackFrameTree ) };
|
enum { CallstackFrameTreeSize = sizeof( CallstackFrameTree ) };
|
||||||
|
|
||||||
|
|
||||||
|
struct CrashEvent
|
||||||
|
{
|
||||||
|
uint64_t thread = 0;
|
||||||
|
int64_t time = 0;
|
||||||
|
uint64_t message = 0;
|
||||||
|
uint32_t callstack = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { CrashEventSize = sizeof( CrashEvent ) };
|
||||||
|
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
|
|
||||||
|
@ -1929,6 +1929,9 @@ void Worker::Process( const QueueItem& ev )
|
|||||||
case QueueType::Crash:
|
case QueueType::Crash:
|
||||||
m_crashed = true;
|
m_crashed = true;
|
||||||
break;
|
break;
|
||||||
|
case QueueType::CrashReport:
|
||||||
|
ProcessCrashReport( ev.crashReport );
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
assert( false );
|
assert( false );
|
||||||
break;
|
break;
|
||||||
@ -2574,6 +2577,9 @@ void Worker::ProcessCallstack( const QueueCallstack& ev )
|
|||||||
case NextCallstackType::Gpu:
|
case NextCallstackType::Gpu:
|
||||||
next.gpu->callstack = it->second;
|
next.gpu->callstack = it->second;
|
||||||
break;
|
break;
|
||||||
|
case NextCallstackType::Crash:
|
||||||
|
m_data.m_crashEvent.callstack = it->second;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
assert( false );
|
assert( false );
|
||||||
break;
|
break;
|
||||||
@ -2610,6 +2616,19 @@ void Worker::ProcessCallstackFrame( const QueueCallstackFrame& ev )
|
|||||||
m_pendingCustomStrings.erase( m_pendingCustomStrings.find( ev.file ) );
|
m_pendingCustomStrings.erase( m_pendingCustomStrings.find( ev.file ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Worker::ProcessCrashReport( const QueueCrashReport& ev )
|
||||||
|
{
|
||||||
|
CheckString( ev.text );
|
||||||
|
|
||||||
|
auto& next = m_nextCallstack[ev.thread];
|
||||||
|
next.type = NextCallstackType::Crash;
|
||||||
|
|
||||||
|
m_data.m_crashEvent.thread = ev.thread;
|
||||||
|
m_data.m_crashEvent.time = TscTime( ev.time );
|
||||||
|
m_data.m_crashEvent.message = ev.text;
|
||||||
|
m_data.m_crashEvent.callstack = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void Worker::MemAllocChanged( int64_t time )
|
void Worker::MemAllocChanged( int64_t time )
|
||||||
{
|
{
|
||||||
const auto val = (double)m_data.memory.usage;
|
const auto val = (double)m_data.memory.usage;
|
||||||
|
@ -140,6 +140,8 @@ private:
|
|||||||
|
|
||||||
std::vector<Vector<ZoneEvent*>> m_zoneChildren;
|
std::vector<Vector<ZoneEvent*>> m_zoneChildren;
|
||||||
std::vector<Vector<GpuEvent*>> m_gpuChildren;
|
std::vector<Vector<GpuEvent*>> m_gpuChildren;
|
||||||
|
|
||||||
|
CrashEvent m_crashEvent;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MbpsBlock
|
struct MbpsBlock
|
||||||
@ -154,7 +156,8 @@ private:
|
|||||||
enum class NextCallstackType
|
enum class NextCallstackType
|
||||||
{
|
{
|
||||||
Zone,
|
Zone,
|
||||||
Gpu
|
Gpu,
|
||||||
|
Crash
|
||||||
};
|
};
|
||||||
|
|
||||||
struct NextCallstack
|
struct NextCallstack
|
||||||
@ -297,6 +300,7 @@ private:
|
|||||||
tracy_force_inline void ProcessCallstackMemory( const QueueCallstackMemory& ev );
|
tracy_force_inline void ProcessCallstackMemory( const QueueCallstackMemory& ev );
|
||||||
tracy_force_inline void ProcessCallstack( const QueueCallstack& ev );
|
tracy_force_inline void ProcessCallstack( const QueueCallstack& ev );
|
||||||
tracy_force_inline void ProcessCallstackFrame( const QueueCallstackFrame& ev );
|
tracy_force_inline void ProcessCallstackFrame( const QueueCallstackFrame& ev );
|
||||||
|
tracy_force_inline void ProcessCrashReport( const QueueCrashReport& ev );
|
||||||
|
|
||||||
tracy_force_inline void ProcessZoneBeginImpl( ZoneEvent* zone, const QueueZoneBegin& ev );
|
tracy_force_inline void ProcessZoneBeginImpl( ZoneEvent* zone, const QueueZoneBegin& ev );
|
||||||
tracy_force_inline void ProcessGpuZoneBeginImpl( GpuEvent* zone, const QueueGpuZoneBegin& ev );
|
tracy_force_inline void ProcessGpuZoneBeginImpl( GpuEvent* zone, const QueueGpuZoneBegin& ev );
|
||||||
|
Loading…
Reference in New Issue
Block a user