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

Send symbol base address.

This commit is contained in:
Bartosz Taudul 2020-02-25 23:03:40 +01:00
parent 85ffe0ea04
commit 3402d16548
5 changed files with 12 additions and 9 deletions

View File

@ -243,10 +243,8 @@ CallstackEntryData DecodeCallstackPtr( uint64_t ptr )
si->SizeOfStruct = sizeof( SYMBOL_INFO ); si->SizeOfStruct = sizeof( SYMBOL_INFO );
si->MaxNameLen = 1024; si->MaxNameLen = 1024;
if( SymFromAddr( proc, ptr, nullptr, si ) == 0 ) const auto symValid = SymFromAddr( proc, ptr, nullptr, si ) != 0;
{ if( !symValid ) GetModuleName( ptr, si->Name, si->NameLen );
GetModuleName( ptr, si->Name, si->NameLen );
}
IMAGEHLP_LINE64 line; IMAGEHLP_LINE64 line;
DWORD displacement = 0; DWORD displacement = 0;
@ -277,6 +275,8 @@ CallstackEntryData DecodeCallstackPtr( uint64_t ptr )
file[fsz] = '\0'; file[fsz] = '\0';
cb_data[write].file = file; cb_data[write].file = file;
cb_data[write].symAddr = symValid ? si->Address : 0;
} }
#ifndef __CYGWIN__ #ifndef __CYGWIN__
@ -286,10 +286,8 @@ CallstackEntryData DecodeCallstackPtr( uint64_t ptr )
{ {
auto& cb = cb_data[i]; auto& cb = cb_data[i];
if( SymFromInlineContext( proc, ptr, ctx, nullptr, si ) == 0 ) const auto symInlineValid = SymFromInlineContext( proc, ptr, ctx, nullptr, si ) != 0;
{ if( !symInlineValid ) GetModuleName( ptr, si->Name, si->NameLen );
GetModuleName( ptr, si->Name, si->NameLen );
}
auto name = (char*)tracy_malloc( si->NameLen + 1 ); auto name = (char*)tracy_malloc( si->NameLen + 1 );
memcpy( name, si->Name, si->NameLen ); memcpy( name, si->Name, si->NameLen );
@ -314,6 +312,8 @@ CallstackEntryData DecodeCallstackPtr( uint64_t ptr )
file[fsz] = '\0'; file[fsz] = '\0';
cb.file = file; cb.file = file;
cb.symAddr = symInlineValid ? si->Address : 0;
ctx++; ctx++;
} }
} }

View File

@ -27,6 +27,7 @@ struct CallstackEntry
const char* name; const char* name;
const char* file; const char* file;
uint32_t line; uint32_t line;
uint64_t symAddr;
}; };
struct CallstackEntryData struct CallstackEntryData

View File

@ -2233,6 +2233,7 @@ void Profiler::SendCallstackFrame( uint64_t ptr )
MemWrite( &item.callstackFrame.name, (uint64_t)frame.name ); MemWrite( &item.callstackFrame.name, (uint64_t)frame.name );
MemWrite( &item.callstackFrame.file, (uint64_t)frame.file ); MemWrite( &item.callstackFrame.file, (uint64_t)frame.file );
MemWrite( &item.callstackFrame.line, frame.line ); MemWrite( &item.callstackFrame.line, frame.line );
MemWrite( &item.callstackFrame.symAddr, frame.symAddr );
AppendData( &item, QueueDataSize[(int)QueueType::CallstackFrame] ); AppendData( &item, QueueDataSize[(int)QueueType::CallstackFrame] );

View File

@ -9,7 +9,7 @@ namespace tracy
constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; } constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; }
enum : uint32_t { ProtocolVersion = 26 }; enum : uint32_t { ProtocolVersion = 27 };
enum : uint32_t { BroadcastVersion = 0 }; enum : uint32_t { BroadcastVersion = 0 };
using lz4sz_t = uint32_t; using lz4sz_t = uint32_t;

View File

@ -309,6 +309,7 @@ struct QueueCallstackFrame
uint64_t name; uint64_t name;
uint64_t file; uint64_t file;
uint32_t line; uint32_t line;
uint64_t symAddr;
}; };
struct QueueCrashReport struct QueueCrashReport