1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 12:23:53 +00:00

Check source file validity against executable time.

This commit is contained in:
Bartosz Taudul 2021-02-06 22:59:07 +01:00
parent e577220e36
commit 3400331de1

View File

@ -7486,7 +7486,8 @@ void Worker::CacheSource( const StringRef& str )
auto file = GetString( str ); auto file = GetString( str );
// Possible duplication of pointer and index strings // Possible duplication of pointer and index strings
if( m_data.sourceFileCache.find( file ) != m_data.sourceFileCache.end() ) return; if( m_data.sourceFileCache.find( file ) != m_data.sourceFileCache.end() ) return;
if( SourceFileValid( file, GetCaptureTime() ) ) const auto execTime = GetExecutableTime();
if( SourceFileValid( file, execTime != 0 ? execTime : GetCaptureTime() ) )
{ {
FILE* f = fopen( file, "rb" ); FILE* f = fopen( file, "rb" );
fseek( f, 0, SEEK_END ); fseek( f, 0, SEEK_END );
@ -7497,7 +7498,7 @@ void Worker::CacheSource( const StringRef& str )
fclose( f ); fclose( f );
m_data.sourceFileCache.emplace( file, MemoryBlock{ src, uint32_t( sz ) } ); m_data.sourceFileCache.emplace( file, MemoryBlock{ src, uint32_t( sz ) } );
} }
else if( m_executableTime != 0 ) else if( execTime != 0 )
{ {
m_sourceCodeQuery.emplace_back( file ); m_sourceCodeQuery.emplace_back( file );
QuerySourceFile( file ); QuerySourceFile( file );