Pass symbol image name to CacheSource().

This commit is contained in:
Bartosz Taudul 2022-05-01 14:25:07 +02:00
parent 33a6853423
commit fd55c1e975
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 20 additions and 8 deletions

View File

@ -3371,7 +3371,7 @@ void Worker::QueryTerminate()
m_sock.Send( &query, ServerQueryPacketSize ); m_sock.Send( &query, ServerQueryPacketSize );
} }
void Worker::QuerySourceFile( const char* fn ) void Worker::QuerySourceFile( const char* fn, const char* image )
{ {
QueryDataTransfer( fn, strlen( fn ) + 1 ); QueryDataTransfer( fn, strlen( fn ) + 1 );
Query( ServerQuerySourceCode, 0 ); Query( ServerQuerySourceCode, 0 );
@ -6597,7 +6597,7 @@ void Worker::ProcessCallstackFrame( const QueueCallstackFrame& ev, bool querySym
StringRef ref( StringRef::Idx, fitidx ); StringRef ref( StringRef::Idx, fitidx );
auto cit = m_checkedFileStrings.find( ref ); auto cit = m_checkedFileStrings.find( ref );
if( cit == m_checkedFileStrings.end() ) CacheSource( ref ); if( cit == m_checkedFileStrings.end() ) CacheSource( ref, m_callstackFrameStaging->imageName );
const auto frameId = PackPointer( m_callstackFrameStagingPtr ); const auto frameId = PackPointer( m_callstackFrameStagingPtr );
#ifndef TRACY_NO_STATISTICS #ifndef TRACY_NO_STATISTICS
@ -6700,7 +6700,7 @@ void Worker::ProcessSymbolInformation( const QueueSymbolInformation& ev )
StringRef ref( StringRef::Idx, idx ); StringRef ref( StringRef::Idx, idx );
auto cit = m_checkedFileStrings.find( ref ); auto cit = m_checkedFileStrings.find( ref );
if( cit == m_checkedFileStrings.end() ) CacheSource( ref ); if( cit == m_checkedFileStrings.end() ) CacheSource( ref, it->second.imageName );
m_pendingSymbols.erase( it ); m_pendingSymbols.erase( it );
} }
@ -6733,7 +6733,19 @@ void Worker::ProcessCodeInformation( const QueueCodeInformation& ev )
StringRef ref( StringRef::Idx, idx ); StringRef ref( StringRef::Idx, idx );
auto cit = m_checkedFileStrings.find( ref ); auto cit = m_checkedFileStrings.find( ref );
if( cit == m_checkedFileStrings.end() ) CacheSource( ref ); if( cit == m_checkedFileStrings.end() )
{
auto& symmap = GetSymbolMap();
auto it = symmap.find( ev.symAddr );
if( it == symmap.end() )
{
CacheSource( ref );
}
else
{
CacheSource( ref, it->second.imageName );
}
}
} }
if( ev.symAddr != 0 ) if( ev.symAddr != 0 )
{ {
@ -8514,7 +8526,7 @@ ZoneExtra& Worker::RequestZoneExtra( ZoneEvent& ev )
} }
} }
void Worker::CacheSource( const StringRef& str ) void Worker::CacheSource( const StringRef& str, const StringIdx& image )
{ {
assert( str.active ); assert( str.active );
assert( m_checkedFileStrings.find( str ) == m_checkedFileStrings.end() ); assert( m_checkedFileStrings.find( str ) == m_checkedFileStrings.end() );
@ -8530,7 +8542,7 @@ void Worker::CacheSource( const StringRef& str )
else if( execTime != 0 ) else if( execTime != 0 )
{ {
m_sourceCodeQuery.emplace_back( file ); m_sourceCodeQuery.emplace_back( file );
QuerySourceFile( file ); QuerySourceFile( file, image.Active() ? GetString( image ) : nullptr );
} }
} }

View File

@ -667,7 +667,7 @@ private:
void Exec(); void Exec();
void Query( ServerQuery type, uint64_t data, uint32_t extra = 0 ); void Query( ServerQuery type, uint64_t data, uint32_t extra = 0 );
void QueryTerminate(); void QueryTerminate();
void QuerySourceFile( const char* fn ); void QuerySourceFile( const char* fn, const char* image );
void QueryDataTransfer( const void* ptr, size_t size ); void QueryDataTransfer( const void* ptr, size_t size );
tracy_force_inline bool DispatchProcess( const QueueItem& ev, const char*& ptr ); tracy_force_inline bool DispatchProcess( const QueueItem& ev, const char*& ptr );
@ -886,7 +886,7 @@ private:
StringLocation StoreString( const char* str, size_t sz ); StringLocation StoreString( const char* str, size_t sz );
const ContextSwitch* const GetContextSwitchDataImpl( uint64_t thread ); const ContextSwitch* const GetContextSwitchDataImpl( uint64_t thread );
void CacheSource( const StringRef& str ); void CacheSource( const StringRef& str, const StringIdx& image = StringIdx() );
void CacheSourceFromFile( const char* fn ); void CacheSourceFromFile( const char* fn );
tracy_force_inline Vector<short_ptr<ZoneEvent>>& GetZoneChildrenMutable( int32_t idx ) { return m_data.zoneChildren[idx]; } tracy_force_inline Vector<short_ptr<ZoneEvent>>& GetZoneChildrenMutable( int32_t idx ) { return m_data.zoneChildren[idx]; }