mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 12:23:53 +00:00
Pass full module path to LoadLibraryEx().
This commit is contained in:
parent
a27d1902ae
commit
d41447b0c9
@ -244,7 +244,16 @@ const char* DecodeCallstackPtrFast( uint64_t ptr )
|
||||
return ret;
|
||||
}
|
||||
|
||||
const char* GetModuleName( uint64_t addr )
|
||||
const char* GetKernelModulePath( uint64_t addr )
|
||||
{
|
||||
assert( addr >> 63 != 0 );
|
||||
if( !s_krnlCache ) return nullptr;
|
||||
auto it = std::lower_bound( s_krnlCache, s_krnlCache + s_krnlCacheCnt, addr, []( const KernelDriver& lhs, const uint64_t& rhs ) { return lhs.addr > rhs; } );
|
||||
if( it == s_krnlCache + s_krnlCacheCnt ) return nullptr;
|
||||
return it->path;
|
||||
}
|
||||
|
||||
static const char* GetModuleName( uint64_t addr )
|
||||
{
|
||||
if( ( addr >> 63 ) != 0 )
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ CallstackSymbolData DecodeCodeAddress( uint64_t ptr );
|
||||
const char* DecodeCallstackPtrFast( uint64_t ptr );
|
||||
CallstackEntryData DecodeCallstackPtr( uint64_t ptr );
|
||||
void InitCallstack();
|
||||
const char* GetModuleName( uint64_t addr );
|
||||
const char* GetKernelModulePath( uint64_t addr );
|
||||
|
||||
#if TRACY_HAS_CALLSTACK == 1
|
||||
|
||||
|
@ -3201,17 +3201,13 @@ void Profiler::HandleSymbolQueueItem( const SymbolQueueItem& si )
|
||||
case SymbolQueueItemType::KernelCode:
|
||||
{
|
||||
#ifdef _WIN32
|
||||
auto mod = GetModuleName( si.ptr );
|
||||
if( strcmp( mod, "<kernel>" ) != 0 )
|
||||
auto mod = GetKernelModulePath( si.ptr );
|
||||
if( mod )
|
||||
{
|
||||
auto fn = DecodeCallstackPtrFast( si.ptr );
|
||||
if( *fn )
|
||||
{
|
||||
char tmp[8192];
|
||||
auto modlen = strlen( mod );
|
||||
memcpy( tmp, mod+1, modlen-2 );
|
||||
tmp[modlen-2] = '\0';
|
||||
auto hnd = LoadLibraryExA( tmp, nullptr, DONT_RESOLVE_DLL_REFERENCES );
|
||||
auto hnd = LoadLibraryExA( mod, nullptr, DONT_RESOLVE_DLL_REFERENCES );
|
||||
if( hnd )
|
||||
{
|
||||
auto ptr = GetProcAddress( hnd, fn );
|
||||
|
Loading…
x
Reference in New Issue
Block a user