1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Retrieve address of symbol, not first instruction in line.

This commit is contained in:
Bartosz Taudul 2021-06-19 19:51:20 +02:00
parent 8045ceee5d
commit ee13d3fa44
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -376,6 +376,11 @@ CallstackSymbolData DecodeCodeAddress( uint64_t ptr )
const auto proc = GetCurrentProcess();
bool done = false;
char buf[sizeof( SYMBOL_INFO ) + MaxNameSize];
auto si = (SYMBOL_INFO*)buf;
si->SizeOfStruct = sizeof( SYMBOL_INFO );
si->MaxNameLen = MaxNameSize;
IMAGEHLP_LINE64 line;
DWORD displacement = 0;
line.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
@ -397,8 +402,16 @@ CallstackSymbolData DecodeCodeAddress( uint64_t ptr )
{
sym.file = line.FileName;
sym.line = line.LineNumber;
sym.symAddr = line.Address;
done = true;
if( _SymFromInlineContext( proc, ptr, ctx, nullptr, si ) != 0 )
{
sym.symAddr = si->Address;
}
else
{
sym.symAddr = 0;
}
}
}
}
@ -415,7 +428,15 @@ CallstackSymbolData DecodeCodeAddress( uint64_t ptr )
{
sym.file = line.FileName;
sym.line = line.LineNumber;
sym.symAddr = line.Address;
if( SymFromAddr( proc, ptr, nullptr, si ) != 0 )
{
sym.symAddr = si->Address;
}
else
{
sym.symAddr = 0;
}
}
}
#ifdef TRACY_DBGHELP_LOCK