From 9d392d2c9049d9b02826aa80096b7ecfb5915526 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 30 Sep 2020 15:57:14 +0200 Subject: [PATCH] Process call stack frames during failure dispatch. --- server/TracyWorker.cpp | 23 ++++++++++++++++++++++- server/TracyWorker.hpp | 1 + 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 1f80a300..c9654d40 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -2989,10 +2989,18 @@ void Worker::DispatchFailure( const QueueItem& ev, const char*& ptr ) switch( ev.hdr.type ) { case QueueType::SingleStringData: + ptr += sizeof( QueueHeader ); + memcpy( &sz, ptr, sizeof( sz ) ); + ptr += sizeof( sz ); + AddSingleStringFailure( ptr, sz ); + ptr += sz; + break; case QueueType::SecondStringData: ptr += sizeof( QueueHeader ); memcpy( &sz, ptr, sizeof( sz ) ); - ptr += sizeof( sz ) + sz; + ptr += sizeof( sz ); + AddSecondString( ptr, sz ); + ptr += sz; break; default: ptr += QueueDataSize[ev.hdr.idx]; @@ -3003,6 +3011,12 @@ void Worker::DispatchFailure( const QueueItem& ev, const char*& ptr ) m_serverQuerySpaceLeft++; break; case QueueType::CallstackFrameSize: + ProcessCallstackFrameSize( ev.callstackFrameSize ); + m_serverQuerySpaceLeft++; + break; + case QueueType::CallstackFrame: + ProcessCallstackFrame( ev.callstackFrame, false ); + break; case QueueType::SymbolInformation: case QueueType::ParamPingback: m_serverQuerySpaceLeft++; @@ -3542,6 +3556,13 @@ void Worker::AddSingleString( const char* str, size_t sz ) m_pendingSingleString = StoreString( str, sz ); } +void Worker::AddSingleStringFailure( const char* str, size_t sz ) +{ + // During failure dispatch processing of most events is ignored, but string data + // is still send. Just ignore anything that was already in the staging area. + m_pendingSingleString = StoreString( str, sz ); +} + void Worker::AddSecondString( const char* str, size_t sz ) { assert( m_pendingSecondString.ptr == nullptr ); diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index 6f6fda7b..98239c58 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -736,6 +736,7 @@ private: void AddString( uint64_t ptr, const char* str, size_t sz ); void AddThreadString( uint64_t id, const char* str, size_t sz ); void AddSingleString( const char* str, size_t sz ); + void AddSingleStringFailure( const char* str, size_t sz ); void AddSecondString( const char* str, size_t sz ); void AddExternalName( uint64_t ptr, const char* str, size_t sz ); void AddExternalThreadName( uint64_t ptr, const char* str, size_t sz );