remove option to enable image cache, use it for TRACY_HAS_CALLSTACK == 3 to obtain image path and addreses instead of dladdr()

This commit is contained in:
trodrigues 2023-12-05 20:01:12 -06:00
parent a618b6e6f8
commit 55f53b9979
2 changed files with 1 additions and 18 deletions

View File

@ -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)

View File

@ -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 <link.h>
#endif
@ -133,16 +133,10 @@ public:
return entry;
}
typedef void (*RefreshCallback)();
void SetOnRefreshCallback( RefreshCallback callback )
{
m_onRefreshCallback = callback;
}
private:
tracy::FastVector<ImageEntry>* 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