From db136d3f66f5db06efda5a0e492cf976b171ce54 Mon Sep 17 00:00:00 2001 From: trodrigues Date: Tue, 12 Dec 2023 10:49:58 -0600 Subject: [PATCH] Disable by default. Add config option ("TRACY_IMAGE_CACHE") to enable it. --- CMakeLists.txt | 1 + meson.build | 4 ++++ public/client/TracyCallstack.cpp | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 578351fe..79214730 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,6 +87,7 @@ 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_LIBBACKTRACE_ELF_DYNLOAD_SUPPORT "Enable libbacktrace to support dynamically loaded elfs in symbol resolution resolution after the first symbol resolve operation" OFF) +set_option(TRACY_IMAGE_CACHE "Enable use of a cache for image paths and address ranges to avoid calling dladdr() per symbol resolve" OFF) if(NOT TRACY_STATIC) target_compile_definitions(TracyClient PRIVATE TRACY_EXPORTS) diff --git a/meson.build b/meson.build index bb0e8458..72116d82 100644 --- a/meson.build +++ b/meson.build @@ -110,6 +110,10 @@ if get_option('tracy_libbacktrace_elf_dynload_support') tracy_compile_args += ['-DTRACY_LIBBACKTRACE_ELF_DYNLOAD_SUPPORT'] endif +if get_option('tracy_image_cache') + tracy_compile_args += ['-DTRACY_IMAGE_CACHE'] +endif + tracy_shared_libs = get_option('default_library') == 'shared' if not tracy_shared_libs and get_option('tracy_shared_libs') warning('tracy_shared_libs is set to true, but default_library is set to static. Building static library.') diff --git a/public/client/TracyCallstack.cpp b/public/client/TracyCallstack.cpp index 1d31ecc9..624a12c2 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 TRACY_HAS_CALLSTACK == 3 +#if defined(TRACY_IMAGE_CACHE) && (TRACY_HAS_CALLSTACK == 3) # define TRACY_USE_IMAGE_CACHE # include #endif