Make PackPointer() part of worker's interface.

This commit is contained in:
Bartosz Taudul 2020-05-10 16:56:13 +02:00
parent d84495d0e1
commit 2f8e817e16
2 changed files with 11 additions and 10 deletions

View File

@ -32,16 +32,6 @@
namespace tracy
{
static tracy_force_inline CallstackFrameId PackPointer( uint64_t ptr )
{
assert( ( ( ptr & 0x3000000000000000 ) << 2 ) == ( ptr & 0xC000000000000000 ) );
CallstackFrameId id;
id.idx = ptr;
id.sel = 0;
id.custom = 0;
return id;
}
static tracy_force_inline uint64_t PackFileLine( uint32_t fileIdx, uint32_t line )
{
return ( uint64_t( fileIdx ) << 32 ) | line;
@ -3779,6 +3769,16 @@ void Worker::AddSymbolCode( uint64_t ptr, const char* data, size_t sz )
cs_close( &handle );
}
CallstackFrameId Worker::PackPointer( uint64_t ptr ) const
{
assert( ( ( ptr & 0x3000000000000000 ) << 2 ) == ( ptr & 0xC000000000000000 ) );
CallstackFrameId id;
id.idx = ptr;
id.sel = 0;
id.custom = 0;
return id;
}
uint64_t Worker::GetCanonicalPointer( const CallstackFrameId& id ) const
{
assert( id.sel == 0 );

View File

@ -440,6 +440,7 @@ public:
const VarArray<CallstackFrameId>& GetCallstack( uint32_t idx ) const { return *m_data.callstackPayload[idx]; }
const CallstackFrameData* GetCallstackFrame( const CallstackFrameId& ptr ) const;
CallstackFrameId PackPointer( uint64_t ptr ) const;
uint64_t GetCanonicalPointer( const CallstackFrameId& id ) const;
const SymbolData* GetSymbolData( uint64_t sym ) const;
const char* GetSymbolCode( uint64_t sym, uint32_t& len ) const;