From 55f53b9979d61a7684a1d520ca2774e8409c6d1e Mon Sep 17 00:00:00 2001 From: trodrigues Date: Tue, 5 Dec 2023 20:01:12 -0600 Subject: [PATCH] remove option to enable image cache, use it for TRACY_HAS_CALLSTACK == 3 to obtain image path and addreses instead of dladdr() --- CMakeLists.txt | 1 - public/client/TracyCallstack.cpp | 18 +----------------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0cd2e5f3..559f75e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,7 +86,6 @@ set_option(TRACY_NO_CRASH_HANDLER "Disable crash handling" OFF) set_option(TRACY_TIMER_FALLBACK "Use lower resolution timers" OFF) set_option(TRACE_CLIENT_LIBUNWIND_BACKTRACE "Use libunwind backtracing where supported" OFF) set_option(TRACY_SYMBOL_OFFLINE_RESOLVE "Instead of full runtime symbol resolution, only resolve the image path and offset to enable offline symbol resolution" OFF) -set_option(TRACY_ENABLE_IMAGE_CACHE "On glibc platforms, when doing offline symbol resolution, use an cache to determine the image path and offset instead of dladdr()" OFF) if(NOT TRACY_STATIC) target_compile_definitions(TracyClient PRIVATE TRACY_EXPORTS) diff --git a/public/client/TracyCallstack.cpp b/public/client/TracyCallstack.cpp index fd50826b..9253096f 100644 --- a/public/client/TracyCallstack.cpp +++ b/public/client/TracyCallstack.cpp @@ -90,7 +90,7 @@ extern "C" const char* ___tracy_demangle( const char* mangled ) #endif #endif -#if defined( TRACY_ENABLE_IMAGE_CACHE) && (TRACY_HAS_CALLSTACK == 3) +#if TRACY_HAS_CALLSTACK == 3 # define TRACY_USE_IMAGE_CACHE # include #endif @@ -133,16 +133,10 @@ public: return entry; } - typedef void (*RefreshCallback)(); - void SetOnRefreshCallback( RefreshCallback callback ) - { - m_onRefreshCallback = callback; - } private: tracy::FastVector* m_images; const char* m_imageName = nullptr; - RefreshCallback m_onRefreshCallback; static int Callback( struct dl_phdr_info* info, size_t size, void* data ) { @@ -185,8 +179,6 @@ private: std::sort( m_images->begin(), m_images->end(), []( const ImageEntry& lhs, const ImageEntry& rhs ) { return lhs.m_startAddress > rhs.m_startAddress; } ); - - if( m_onRefreshCallback ) m_onRefreshCallback(); } const ImageEntry* GetImageEntryForAddress( void* address ) const @@ -909,15 +901,7 @@ void InitCallstack() } else { -#ifdef TRACY_USE_IMAGE_CACHE - s_imageCache->SetOnRefreshCallback([]() - { - // FIXME: there is no backtrace_destroy_state(), so we are forced to leak... - cb_bts = backtrace_create_state( nullptr, 0, nullptr, nullptr ); - }); -#else cb_bts = backtrace_create_state( nullptr, 0, nullptr, nullptr ); -#endif // #ifdef TRACY_USE_IMAGE_CACHE } #ifndef TRACY_DEMANGLE