From 17855cbac55f1164aa882fcd20135770db0a03d7 Mon Sep 17 00:00:00 2001 From: Lectem Date: Wed, 8 Dec 2021 21:30:06 +0100 Subject: [PATCH] Call SymLoadModuleEx for modules loaded after init This fixes issue #293. Symbols are not loaded if the module is loaded dynamically after the SymInitialize call. This may stall the symbol resolver thread a bit the first time a module is loaded. --- client/TracyCallstack.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/TracyCallstack.cpp b/client/TracyCallstack.cpp index 0dff7c81..0e0af4a9 100644 --- a/client/TracyCallstack.cpp +++ b/client/TracyCallstack.cpp @@ -296,6 +296,8 @@ static const char* GetModuleName( uint64_t addr ) const auto res = GetModuleFileNameA( mod[i], name, 1021 ); if( res > 0 ) { + // since this is the first time we encounter this module, load its symbols (needed for modules loaded after SymInitialize) + SymLoadModuleEx(proc, NULL, name, NULL, (DWORD64)info.lpBaseOfDll, info.SizeOfImage, NULL, 0); auto ptr = name + res; while( ptr > name && *ptr != '\\' && *ptr != '/' ) ptr--; if( ptr > name ) ptr++;