From c999a74d340fb7ac764a27a2c57b2695feeb42ae Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 25 Mar 2020 18:32:36 +0100 Subject: [PATCH] Symbol length transfer. --- client/TracyProfiler.cpp | 8 ++++++++ common/TracyProtocol.hpp | 2 +- common/TracyQueue.hpp | 1 + server/TracyEvent.hpp | 1 + server/TracyWorker.cpp | 5 ++++- server/TracyWorker.hpp | 1 + 6 files changed, 16 insertions(+), 2 deletions(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 2e49606d..a8715306 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -2281,6 +2281,14 @@ void Profiler::SendCallstackFrame( uint64_t ptr ) MemWrite( &item.callstackFrame.file, (uint64_t)frame.file ); MemWrite( &item.callstackFrame.line, frame.line ); MemWrite( &item.callstackFrame.symAddr, frame.symAddr ); + if( frame.symLen > ( 1 << 24 ) ) + { + memset( item.callstackFrame.symLen, 0, 3 ); + } + else + { + memcpy( item.callstackFrame.symLen, &frame.symLen, 3 ); + } AppendData( &item, QueueDataSize[(int)QueueType::CallstackFrame] ); diff --git a/common/TracyProtocol.hpp b/common/TracyProtocol.hpp index 5f91108e..28fcc2a2 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 = 28 }; +enum : uint32_t { ProtocolVersion = 29 }; enum : uint32_t { BroadcastVersion = 1 }; using lz4sz_t = uint32_t; diff --git a/common/TracyQueue.hpp b/common/TracyQueue.hpp index 9ed6e9fe..b8726af2 100644 --- a/common/TracyQueue.hpp +++ b/common/TracyQueue.hpp @@ -319,6 +319,7 @@ struct QueueCallstackFrame uint64_t file; uint32_t line; uint64_t symAddr; + char symLen[3]; }; struct QueueSymbolInformation diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index d4fa12f7..853cfe1e 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -332,6 +332,7 @@ struct SymbolData : public CallstackFrameBasic StringIdx callFile; uint32_t callLine; uint8_t isInline; + Int24 size; }; enum { CallstackFrameBasicSize = sizeof( CallstackFrameBasic ) }; diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 29525f90..dfd8d3c4 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -5121,7 +5121,9 @@ void Worker::ProcessCallstackFrame( const QueueCallstackFrame& ev ) if( ev.symAddr != 0 && m_data.symbolMap.find( ev.symAddr ) == m_data.symbolMap.end() && m_pendingSymbols.find( ev.symAddr ) == m_pendingSymbols.end() ) { - m_pendingSymbols.emplace( ev.symAddr, SymbolPending { name, m_callstackFrameStaging->imageName, file, ev.line, idx < m_callstackFrameStaging->size - 1 } ); + uint32_t size = 0; + memcpy( &size, ev.symLen, 3 ); + m_pendingSymbols.emplace( ev.symAddr, SymbolPending { name, m_callstackFrameStaging->imageName, file, ev.line, size, idx < m_callstackFrameStaging->size - 1 } ); Query( ServerQuerySymbol, ev.symAddr ); } @@ -5176,6 +5178,7 @@ void Worker::ProcessSymbolInformation( const QueueSymbolInformation& ev ) sd.callFile = it->second.file; sd.callLine = it->second.line; sd.isInline = it->second.isInline; + sd.size.SetVal( it->second.size ); m_data.symbolMap.emplace( ev.symAddr, std::move( sd ) ); m_pendingSymbols.erase( it ); diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index 31cef4a8..b7ac5414 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -179,6 +179,7 @@ private: StringIdx imageName; StringIdx file; uint32_t line; + uint32_t size; bool isInline; };