Store symbol addresses.

This commit is contained in:
Bartosz Taudul 2020-02-25 23:42:59 +01:00
parent ca894be51d
commit af58649113
4 changed files with 32 additions and 4 deletions

View File

@ -314,13 +314,18 @@ enum { MemEventSize = sizeof( MemEvent ) };
static_assert( std::is_standard_layout<MemEvent>::value, "MemEvent is not standard layout" );
struct CallstackFrame
struct CallstackFrameBasic
{
StringIdx name;
StringIdx file;
uint32_t line;
};
struct CallstackFrame : public CallstackFrameBasic
{
uint64_t symAddr;
};
enum { CallstackFrameSize = sizeof( CallstackFrame ) };
struct CallstackFrameData

View File

@ -7,7 +7,7 @@ namespace Version
{
enum { Major = 0 };
enum { Minor = 6 };
enum { Patch = 4 };
enum { Patch = 5 };
}
}

View File

@ -1330,7 +1330,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
m_data.callstackPayload.push_back_no_space_check( arr );
}
if( fileVer >= FileVersion( 0, 5, 8 ) )
if( fileVer >= FileVersion( 0, 6, 5 ) )
{
f.Read( sz );
m_data.callstackFrameMap.reserve( sz );
@ -1346,6 +1346,26 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
m_data.callstackFrameMap.emplace( id, frameData );
}
}
else if( fileVer >= FileVersion( 0, 5, 8 ) )
{
f.Read( sz );
m_data.callstackFrameMap.reserve( sz );
for( uint64_t i=0; i<sz; i++ )
{
CallstackFrameId id;
auto frameData = m_slab.Alloc<CallstackFrameData>();
f.Read2( id, frameData->size );
frameData->data = m_slab.Alloc<CallstackFrame>( frameData->size );
for( uint8_t j=0; j<frameData->size; j++ )
{
f.Read3( frameData->data[j].name, frameData->data[j].file, frameData->data[j].line );
frameData->data[j].symAddr = 0;
}
m_data.callstackFrameMap.emplace( id, frameData );
}
}
else
{
f.Read( sz );
@ -1365,6 +1385,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
f.Read( str );
if( str.active ) frameData->data[j].file.SetIdx( str.idx );
f.Read( frameData->data[j].line );
frameData->data[j].symAddr = 0;
}
m_data.callstackFrameMap.emplace( id, frameData );
@ -3093,6 +3114,7 @@ void Worker::AddCallstackAllocPayload( uint64_t ptr, const char* data, size_t _s
cf.name = StoreString( data, sz ).idx; data += sz;
memcpy( &sz, data, 4 ); data += 4;
cf.file = StoreString( data, sz ).idx; data += sz;
cf.symAddr = 0;
CallstackFrameData cfd = { &cf, 1 };
CallstackFrameId id;
@ -4683,6 +4705,7 @@ void Worker::ProcessCallstackFrame( const QueueCallstackFrame& ev )
m_callstackFrameStaging->data[idx].name = StringIdx( nit->second.idx );
m_callstackFrameStaging->data[idx].file = StringIdx( fit->second.idx );
m_callstackFrameStaging->data[idx].line = ev.line;
m_callstackFrameStaging->data[idx].symAddr = ev.symAddr;
if( --m_pendingCallstackSubframes == 0 )
{

View File

@ -172,7 +172,7 @@ private:
if( lhs->size != rhs->size ) return false;
for( uint8_t i=0; i<lhs->size; i++ )
{
if( memcmp( lhs->data + i, rhs->data + i, sizeof( CallstackFrame ) ) != 0 ) return false;
if( memcmp( lhs->data + i, rhs->data + i, sizeof( CallstackFrameBasic ) ) != 0 ) return false;
}
return true;
}