From 2988d0a136f3e051dcd5381e5c2b8a1f6908db3a Mon Sep 17 00:00:00 2001 From: trodrigues Date: Fri, 10 Nov 2023 16:17:39 -0600 Subject: [PATCH] rename libunwind option and add it to cmake --- CMakeLists.txt | 1 + public/client/TracyCallstack.hpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4cb71bdd..7bf17c31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,6 +84,7 @@ set_option(TRACY_MANUAL_LIFETIME "Enable the manual lifetime management of the p set_option(TRACY_FIBERS "Enable fibers support" OFF) 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) if(NOT TRACY_STATIC) target_compile_definitions(TracyClient PRIVATE TRACY_EXPORTS) diff --git a/public/client/TracyCallstack.hpp b/public/client/TracyCallstack.hpp index 36e295a1..b24d7adf 100644 --- a/public/client/TracyCallstack.hpp +++ b/public/client/TracyCallstack.hpp @@ -8,7 +8,7 @@ #if TRACY_HAS_CALLSTACK == 2 || TRACY_HAS_CALLSTACK == 5 # include #elif TRACY_HAS_CALLSTACK >= 3 - #ifdef USE_LIB_UNWIND_BACKTRACE + #ifdef TRACE_CLIENT_LIBUNWIND_BACKTRACE // libunwind is in general significantly faster than execinfo based backtraces #define UNW_LOCAL_ONLY # include @@ -134,7 +134,7 @@ static tracy_force_inline void* Callstack( int depth ) auto trace = (uintptr_t*)tracy_malloc( ( 1 + (size_t)depth ) * sizeof( uintptr_t ) ); -#ifdef USE_LIB_UNWIND_BACKTRACE +#ifdef TRACE_CLIENT_LIBUNWIND_BACKTRACE size_t num = unw_backtrace( (void**)(trace+1), depth ); #else const auto num = (size_t)backtrace( (void**)(trace+1), depth );