Transfer executable image name in source file queries.

This commit is contained in:
Bartosz Taudul 2022-05-01 14:30:18 +02:00
parent fd55c1e975
commit aa2bbfe5f9
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
4 changed files with 15 additions and 2 deletions

View File

@ -1354,6 +1354,7 @@ Profiler::Profiler()
, m_deferredQueue( 64*1024 ) , m_deferredQueue( 64*1024 )
#endif #endif
, m_paramCallback( nullptr ) , m_paramCallback( nullptr )
, m_queryImage( nullptr )
, m_queryData( nullptr ) , m_queryData( nullptr )
, m_crashHandlerInstalled( false ) , m_crashHandlerInstalled( false )
{ {
@ -3384,7 +3385,11 @@ bool Profiler::HandleServerQuery()
HandleSourceCodeQuery(); HandleSourceCodeQuery();
break; break;
case ServerQueryDataTransfer: case ServerQueryDataTransfer:
assert( !m_queryData ); if( m_queryData )
{
assert( !m_queryImage );
m_queryImage = m_queryData;
}
m_queryDataPtr = m_queryData = (char*)tracy_malloc( ptr + 11 ); m_queryDataPtr = m_queryData = (char*)tracy_malloc( ptr + 11 );
AckServerQuery(); AckServerQuery();
break; break;
@ -3840,6 +3845,12 @@ void Profiler::HandleSourceCodeQuery()
AckSourceCodeNotAvailable(); AckSourceCodeNotAvailable();
} }
m_queryData = nullptr; m_queryData = nullptr;
if( m_queryImage )
{
tracy_free_fast( m_queryImage );
m_queryImage = nullptr;
}
} }
#if defined _WIN32 && defined TRACY_TIMER_QPC #if defined _WIN32 && defined TRACY_TIMER_QPC

View File

@ -923,6 +923,7 @@ private:
ParameterCallback m_paramCallback; ParameterCallback m_paramCallback;
char* m_queryImage;
char* m_queryData; char* m_queryData;
char* m_queryDataPtr; char* m_queryDataPtr;

View File

@ -9,7 +9,7 @@ namespace tracy
constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; } constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; }
enum : uint32_t { ProtocolVersion = 56 }; enum : uint32_t { ProtocolVersion = 57 };
enum : uint16_t { BroadcastVersion = 2 }; enum : uint16_t { BroadcastVersion = 2 };
using lz4sz_t = uint32_t; using lz4sz_t = uint32_t;

View File

@ -3373,6 +3373,7 @@ void Worker::QueryTerminate()
void Worker::QuerySourceFile( const char* fn, const char* image ) void Worker::QuerySourceFile( const char* fn, const char* image )
{ {
if( image ) QueryDataTransfer( image, strlen( image ) + 1 );
QueryDataTransfer( fn, strlen( fn ) + 1 ); QueryDataTransfer( fn, strlen( fn ) + 1 );
Query( ServerQuerySourceCode, 0 ); Query( ServerQuerySourceCode, 0 );
} }