diff --git a/TracyLua.hpp b/TracyLua.hpp index 5490467c..e4e0e71c 100644 --- a/TracyLua.hpp +++ b/TracyLua.hpp @@ -150,9 +150,9 @@ static tracy_force_inline void SendLuaCallstack( lua_State* L, uint32_t depth ) const char* func[64]; uint32_t fsz[64]; uint32_t ssz[64]; - uint32_t spaceNeeded = 4; // cnt + uint16_t spaceNeeded = 2; // cnt - uint32_t cnt; + uint8_t cnt; for( cnt=0; cnt::max() ); + memcpy( dst, fsz+i, 2 ); dst += 2; memcpy( dst, func[i], fsz[i] ); dst += fsz[i]; - memcpy( dst, ssz+i, 4 ); dst += 4; + assert( ssz[i] <= std::numeric_limits::max() ); + memcpy( dst, ssz+i, 2 ); dst += 2; memcpy( dst, dbg[i].source, ssz[i] ), dst += ssz[i]; } - assert( dst - ptr == spaceNeeded + 4 ); + assert( dst - ptr == spaceNeeded + 2 ); TracyLfqPrepare( QueueType::CallstackAlloc ); MemWrite( &item->callstackAlloc.ptr, (uint64_t)ptr ); diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 0aa1326a..8d2da1a8 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -2307,15 +2307,15 @@ void Profiler::SendCallstackAlloc( uint64_t _ptr ) MemWrite( &item.hdr.type, QueueType::CallstackAllocPayload ); MemWrite( &item.stringTransfer.ptr, _ptr ); - const auto len = *((uint32_t*)ptr); - assert( len <= std::numeric_limits::max() ); - const auto l16 = uint16_t( len ); + uint16_t len; + memcpy( &len, ptr, 2 ); + ptr += 2; - NeedDataSize( QueueDataSize[(int)QueueType::CallstackAllocPayload] + sizeof( l16 ) + l16 ); + NeedDataSize( QueueDataSize[(int)QueueType::CallstackAllocPayload] + sizeof( len ) + len ); AppendDataUnsafe( &item, QueueDataSize[(int)QueueType::CallstackAllocPayload] ); - AppendDataUnsafe( &l16, sizeof( l16 ) ); - AppendDataUnsafe( ptr + 4, l16 ); + AppendDataUnsafe( &len, sizeof( len ) ); + AppendDataUnsafe( ptr, len ); } void Profiler::SendCallstackFrame( uint64_t ptr ) diff --git a/common/TracyProtocol.hpp b/common/TracyProtocol.hpp index 2160811e..634b5846 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 = 35 }; +enum : uint32_t { ProtocolVersion = 36 }; enum : uint32_t { BroadcastVersion = 1 }; using lz4sz_t = uint32_t; diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index a21b275a..5d19a8b6 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -3487,16 +3487,17 @@ void Worker::AddCallstackPayload( uint64_t ptr, const char* _data, size_t _sz ) void Worker::AddCallstackAllocPayload( uint64_t ptr, const char* data, size_t _sz ) { CallstackFrameId stack[64]; - const auto sz = *(uint32_t*)data; data += 4; + uint8_t sz; + memcpy( &sz, data, 1 ); data++; assert( sz <= 64 ); - for( uint32_t i=0; i