From a237f108c71a483d1e0cbad2ee0cb0b9a2eda0dd Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 17 Aug 2022 15:42:16 +0200 Subject: [PATCH] Use source contents callback. --- public/client/TracyProfiler.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/public/client/TracyProfiler.cpp b/public/client/TracyProfiler.cpp index 41131b84..8f5c210a 100644 --- a/public/client/TracyProfiler.cpp +++ b/public/client/TracyProfiler.cpp @@ -3883,6 +3883,21 @@ void Profiler::HandleSourceCodeQuery() } #endif + if( !ok && m_sourceCallback ) + { + size_t sz; + char* ptr = m_sourceCallback( m_sourceCallbackData, m_queryData, sz ); + if( ptr ) + { + if( sz < ( TargetFrameSize - 16 ) ) + { + SendLongString( (uint64_t)ptr, ptr, sz, QueueType::SourceCode ); + ok = true; + } + tracy_free_fast( ptr ); + } + } + if( !ok ) AckSourceCodeNotAvailable(); tracy_free_fast( m_queryData );