diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 46f0ed20..f8a45184 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -40,6 +40,15 @@ namespace tracy { +static inline CallstackFrameId PackPointer( uint64_t ptr ) +{ + assert( ( ( ptr & 0x4000000000000000 ) << 1 ) == ( ptr & 0x8000000000000000 ) ); + CallstackFrameId id; + id.idx = ptr; + id.sel = 0; + return id; +} + static constexpr int FileVersion( uint8_t h5, uint8_t h6, uint8_t h7 ) { return ( h5 << 16 ) | ( h6 << 8 ) | h7; @@ -2021,6 +2030,12 @@ void Worker::AddCustomString( uint64_t ptr, char* str, size_t sz ) m_pendingCustomStrings.emplace( ptr, StoreString( str, sz ) ); } +uint64_t Worker::GetCanonicalPointer( const CallstackFrameId& id ) const +{ + assert( id.sel == 0 ); + return ( id.idx & 0x7FFFFFFFFFFFFFFF ) | ( ( id.idx & 0x4000000000000000 ) << 1 ); +} + void Worker::AddCallstackPayload( uint64_t ptr, char* _data, size_t sz ) { assert( m_pendingCallstacks.find( ptr ) == m_pendingCallstacks.end() ); diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index b5fd5ead..9d2bb3d3 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -246,6 +246,7 @@ public: const VarArray& GetCallstack( uint32_t idx ) const { return *m_data.callstackPayload[idx]; } const CallstackFrameData* GetCallstackFrame( uint64_t ptr ) const; + uint64_t GetCanonicalPointer( const CallstackFrameId& id ) const; const CrashEvent& GetCrashEvent() const { return m_data.m_crashEvent; }