Skip to content

Commit

Permalink
Transfer executable image name in source file queries.
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfpld committed May 1, 2022
1 parent fd55c1e commit aa2bbfe
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
13 changes: 12 additions & 1 deletion client/TracyProfiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1354,6 +1354,7 @@ Profiler::Profiler()
, m_deferredQueue( 64*1024 )
#endif
, m_paramCallback( nullptr )
, m_queryImage( nullptr )
, m_queryData( nullptr )
, m_crashHandlerInstalled( false )
{
Expand Down Expand Up @@ -3384,7 +3385,11 @@ bool Profiler::HandleServerQuery()
HandleSourceCodeQuery();
break;
case ServerQueryDataTransfer:
assert( !m_queryData );
if( m_queryData )
{
assert( !m_queryImage );
m_queryImage = m_queryData;
}
m_queryDataPtr = m_queryData = (char*)tracy_malloc( ptr + 11 );
AckServerQuery();
break;
Expand Down Expand Up @@ -3840,6 +3845,12 @@ void Profiler::HandleSourceCodeQuery()
AckSourceCodeNotAvailable();
}
m_queryData = nullptr;

if( m_queryImage )
{
tracy_free_fast( m_queryImage );
m_queryImage = nullptr;
}
}

#if defined _WIN32 && defined TRACY_TIMER_QPC
Expand Down
1 change: 1 addition & 0 deletions client/TracyProfiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,7 @@ class Profiler

ParameterCallback m_paramCallback;

char* m_queryImage;
char* m_queryData;
char* m_queryDataPtr;

Expand Down
2 changes: 1 addition & 1 deletion common/TracyProtocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace tracy

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 };

using lz4sz_t = uint32_t;
Expand Down
1 change: 1 addition & 0 deletions server/TracyWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3373,6 +3373,7 @@ void Worker::QueryTerminate()

void Worker::QuerySourceFile( const char* fn, const char* image )
{
if( image ) QueryDataTransfer( image, strlen( image ) + 1 );
QueryDataTransfer( fn, strlen( fn ) + 1 );
Query( ServerQuerySourceCode, 0 );
}
Expand Down

0 comments on commit aa2bbfe

Please sign in to comment.