mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Query source location of each assembly instruction.
This commit is contained in:
@@ -2373,6 +2373,9 @@ bool Profiler::HandleServerQuery()
|
||||
case ServerQuerySymbolCode:
|
||||
HandleSymbolCodeQuery( ptr, extra );
|
||||
break;
|
||||
case ServerQueryCodeLocation:
|
||||
SendCodeLocation( ptr );
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
@@ -2773,6 +2776,25 @@ void Profiler::HandleSymbolCodeQuery( uint64_t symbol, uint32_t size )
|
||||
SendLongString( symbol, (const char*)symbol, size, QueueType::SymbolCode );
|
||||
}
|
||||
|
||||
void Profiler::SendCodeLocation( uint64_t ptr )
|
||||
{
|
||||
#ifdef TRACY_HAS_CALLSTACK
|
||||
const auto sym = DecodeCodeAddress( ptr );
|
||||
|
||||
SendString( uint64_t( sym.file ), sym.file, QueueType::CustomStringData );
|
||||
|
||||
QueueItem item;
|
||||
MemWrite( &item.hdr.type, QueueType::CodeInformation );
|
||||
MemWrite( &item.codeInformation.ptr, ptr );
|
||||
MemWrite( &item.codeInformation.file, uint64_t( sym.file ) );
|
||||
MemWrite( &item.codeInformation.line, sym.line );
|
||||
|
||||
AppendData( &item, QueueDataSize[(int)QueueType::CodeInformation] );
|
||||
|
||||
if( sym.needFree ) tracy_free( (void*)sym.file );
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user