rename libunwind option and add it to cmake

This commit is contained in:
trodrigues 2023-11-10 16:17:39 -06:00
parent 95cb3e1f5a
commit 2988d0a136
2 changed files with 3 additions and 2 deletions

View File

@ -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_FIBERS "Enable fibers support" OFF)
set_option(TRACY_NO_CRASH_HANDLER "Disable crash handling" OFF) set_option(TRACY_NO_CRASH_HANDLER "Disable crash handling" OFF)
set_option(TRACY_TIMER_FALLBACK "Use lower resolution timers" 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) if(NOT TRACY_STATIC)
target_compile_definitions(TracyClient PRIVATE TRACY_EXPORTS) target_compile_definitions(TracyClient PRIVATE TRACY_EXPORTS)

View File

@ -8,7 +8,7 @@
#if TRACY_HAS_CALLSTACK == 2 || TRACY_HAS_CALLSTACK == 5 #if TRACY_HAS_CALLSTACK == 2 || TRACY_HAS_CALLSTACK == 5
# include <unwind.h> # include <unwind.h>
#elif TRACY_HAS_CALLSTACK >= 3 #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 // libunwind is in general significantly faster than execinfo based backtraces
#define UNW_LOCAL_ONLY #define UNW_LOCAL_ONLY
# include <libunwind.h> # include <libunwind.h>
@ -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 ) ); 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 ); size_t num = unw_backtrace( (void**)(trace+1), depth );
#else #else
const auto num = (size_t)backtrace( (void**)(trace+1), depth ); const auto num = (size_t)backtrace( (void**)(trace+1), depth );