From aa2bbfe5f9dea5b919984e7051a361b3e4efdadb Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 1 May 2022 14:30:18 +0200 Subject: [PATCH] Transfer executable image name in source file queries. --- client/TracyProfiler.cpp | 13 ++++++++++++- client/TracyProfiler.hpp | 1 + common/TracyProtocol.hpp | 2 +- server/TracyWorker.cpp | 1 + 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index c2a978ea..7648d410 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -1354,6 +1354,7 @@ Profiler::Profiler() , m_deferredQueue( 64*1024 ) #endif , m_paramCallback( nullptr ) + , m_queryImage( nullptr ) , m_queryData( nullptr ) , m_crashHandlerInstalled( false ) { @@ -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; @@ -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 diff --git a/client/TracyProfiler.hpp b/client/TracyProfiler.hpp index fab7770b..595b81bf 100644 --- a/client/TracyProfiler.hpp +++ b/client/TracyProfiler.hpp @@ -923,6 +923,7 @@ private: ParameterCallback m_paramCallback; + char* m_queryImage; char* m_queryData; char* m_queryDataPtr; diff --git a/common/TracyProtocol.hpp b/common/TracyProtocol.hpp index dc2df5f0..e74f0029 100644 --- a/common/TracyProtocol.hpp +++ b/common/TracyProtocol.hpp @@ -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; diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 7a1b1c32..f867d869 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -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 ); }