1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 12:23:53 +00:00

Apparently sampled call stacks may be empty.

This commit is contained in:
Bartosz Taudul 2020-03-28 16:09:44 +01:00
parent d43461584a
commit 9b8eb69886

View File

@ -144,14 +144,17 @@ void WINAPI EventRecordCallback( PEVENT_RECORD record )
if( sw->stackProcess == s_pid && ( sw->stack[0] & 0x8000000000000000 ) == 0 ) if( sw->stackProcess == s_pid && ( sw->stack[0] & 0x8000000000000000 ) == 0 )
{ {
const uint64_t sz = ( record->UserDataLength - 16 ) / 8; const uint64_t sz = ( record->UserDataLength - 16 ) / 8;
auto trace = (uint64_t*)tracy_malloc( ( 1 + sz ) * sizeof( uint64_t ) ); if( sz > 0 )
memcpy( trace, &sz, sizeof( uint64_t ) ); {
memcpy( trace+1, sw->stack, sizeof( uint64_t ) * sz ); auto trace = (uint64_t*)tracy_malloc( ( 1 + sz ) * sizeof( uint64_t ) );
TracyLfqPrepare( QueueType::CallstackSample ); memcpy( trace, &sz, sizeof( uint64_t ) );
MemWrite( &item->callstackSample.time, sw->eventTimeStamp ); memcpy( trace+1, sw->stack, sizeof( uint64_t ) * sz );
MemWrite( &item->callstackSample.thread, (uint64_t)sw->stackThread ); TracyLfqPrepare( QueueType::CallstackSample );
MemWrite( &item->callstackSample.ptr, (uint64_t)trace ); MemWrite( &item->callstackSample.time, sw->eventTimeStamp );
TracyLfqCommit; MemWrite( &item->callstackSample.thread, (uint64_t)sw->stackThread );
MemWrite( &item->callstackSample.ptr, (uint64_t)trace );
TracyLfqCommit;
}
} }
} }
break; break;