From fc1b03d67d9d6065d4f986ab9f20d8a24532988f Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 2 Oct 2020 22:14:33 +0200 Subject: [PATCH] Remove non-canonical pointer at the end of sampled stack. --- client/TracySysTrace.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/TracySysTrace.cpp b/client/TracySysTrace.cpp index 6ec574e6..1f42ae6e 100644 --- a/client/TracySysTrace.cpp +++ b/client/TracySysTrace.cpp @@ -727,6 +727,12 @@ static void SetupSampling( int64_t& samplingPeriod ) auto trace = (uint64_t*)tracy_malloc( ( 1 + cnt ) * sizeof( uint64_t ) ); s_ring[i].Read( trace+1, offset, sizeof( uint64_t ) * cnt ); + // remove non-canonical pointer at the end + const auto test = (int64_t)trace[cnt]; + const auto m1 = test >> 63; + const auto m2 = test >> 47; + if( m1 != m2 ) cnt--; + // skip kernel frames uint64_t j; for( j=0; j