From 2d5f6a411cd4121bd67857585d3653c9ae3e95e5 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 15 Jun 2021 21:08:09 +0200 Subject: [PATCH] Add windows kernel module discovery. --- client/TracyCallstack.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/client/TracyCallstack.cpp b/client/TracyCallstack.cpp index 66f556cc..cf0d5e24 100644 --- a/client/TracyCallstack.cpp +++ b/client/TracyCallstack.cpp @@ -256,7 +256,18 @@ const char* DecodeCallstackPtrFast( uint64_t ptr ) static const char* GetModuleName( uint64_t addr ) { - if( ( addr >> 63 ) != 0 ) return ""; + if( ( addr >> 63 ) != 0 ) + { + if( s_krnlCache ) + { + 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 it->mod; + } + } + return ""; + } #ifndef __CYGWIN__ for( auto& v : *s_modCache )