diff --git a/client/TracyCallstack.cpp b/client/TracyCallstack.cpp index 4d2c7437..0040efe6 100644 --- a/client/TracyCallstack.cpp +++ b/client/TracyCallstack.cpp @@ -76,6 +76,45 @@ void InitCallstack() #endif SymInitialize( GetCurrentProcess(), nullptr, true ); SymSetOptions( SYMOPT_LOAD_LINES ); + + HMODULE mod[1024]; + DWORD needed; + HANDLE proc = GetCurrentProcess(); + +#ifndef __CYGWIN__ + if( EnumProcessModules( proc, mod, sizeof( mod ), &needed ) != 0 ) + { + const auto sz = needed / sizeof( HMODULE ); + for( size_t i=0; i 0 ) + { + auto ptr = name + res; + while( ptr > name && *ptr != '\\' && *ptr != '/' ) ptr--; + if( ptr > name ) ptr++; + const auto namelen = name + res - ptr; + auto cache = (ModuleCache*)tracy_malloc( sizeof( ModuleCache ) ); + cache->start = base; + cache->end = base + info.SizeOfImage; + cache->name = (char*)tracy_malloc( namelen+3 ); + cache->name[0] = '['; + memcpy( cache->name+1, ptr, namelen ); + cache->name[namelen+1] = ']'; + cache->name[namelen+2] = '\0'; + cache->nameLen = namelen+2; + cache->next = s_modCache; + s_modCache = cache; + } + } + } + } +#endif } TRACY_API tracy_force_inline uintptr_t* CallTrace( int depth )