From 0ccb365a3834f93f0eecd24d1e0adf984d37d7b2 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Tue, 9 Dec 2014 11:18:08 +0100 Subject: [PATCH] Add compile-check around unw_set_cache_log_size. --- CMakeLists.txt | 2 ++ libheaptrack.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4eba06b..c28e8ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,8 @@ if (NOT HAVE_UNW_BACKTRACE) message(FATAL_ERROR "Your libunwind version is apparently too old and does not have the unw_backtrace function.") endif() +check_library_exists (${LIBUNWIND_LIBRARY} _ULx86_64_set_cache_log_size "" HAVE_UNW_SET_CACHE_LOG_SIZE) + include (CheckCXXSourceCompiles) check_cxx_source_compiles( "#include diff --git a/libheaptrack.cpp b/libheaptrack.cpp index 124e80b..ca3d0c5 100644 --- a/libheaptrack.cpp +++ b/libheaptrack.cpp @@ -333,9 +333,11 @@ void heaptrack_init(const char *outputFileName, void (*initCallbackBefore) (), v if (unw_set_caching_policy(unw_local_addr_space, UNW_CACHE_PER_THREAD)) { fprintf(stderr, "Failed to enable per-thread libunwind caching.\n"); } +#if HAVE_UNW_SET_CACHE_LOG_SIZE if (unw_set_cache_log_size(unw_local_addr_space, 10)) { fprintf(stderr, "Failed to set libunwind cache size.\n"); } +#endif data.reset(new Data(outputFileName, stopCallback)); -- 2.7.4