1
0
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:
Bartosz Taudul
2020-04-01 21:43:03 +02:00
parent 0ba0125eb5
commit b2a8b53efa
8 changed files with 84 additions and 10 deletions
+22
View File
@@ -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
+1
View File
@@ -553,6 +553,7 @@ private:
void SendCallstackPayload64( uint64_t ptr );
void SendCallstackAlloc( uint64_t ptr );
void SendCallstackFrame( uint64_t ptr );
void SendCodeLocation( uint64_t ptr );
bool HandleServerQuery();
void HandleDisconnect();