From: Milian Wolff Date: Thu, 11 Dec 2014 13:32:59 +0000 (+0100) Subject: Adapt to libunwind changes with unw_set_cache_size. X-Git-Tag: submit/tizen/20180620.112952^2~364 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2c74cd539cfdbcafed52e390cebd09ceb255d820;p=sdk%2Ftools%2Fheaptrack.git Adapt to libunwind changes with unw_set_cache_size. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ea2420..bd8c7c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ 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) +check_library_exists (${LIBUNWIND_LIBRARY} _ULx86_64_set_cache_size "" HAVE_UNW_SET_CACHE_SIZE) include (CheckCXXSourceCompiles) check_cxx_source_compiles( @@ -48,6 +48,8 @@ include_directories( ${LIBUNWIND_INCLUDE_DIR} ) +configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) + add_library(heaptrack_preload MODULE heaptrack_preload.cpp libheaptrack.cpp) target_link_libraries(heaptrack_preload PRIVATE ${CMAKE_DL_LIBS} backtrace rt) add_library(heaptrack_inject MODULE heaptrack_inject.cpp libheaptrack.cpp) diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 0000000..eb14503 --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,24 @@ +/* + * Copyright 2014 Milian Wolff + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#cmakedefine01 HAVE_UNW_SET_CACHE_SIZE + +#cmakedefine01 HAVE_UNW_BACKTRACE + +#cmakedefine01 HAVE_UNW_BACKTRACE_SKIP diff --git a/libheaptrack.cpp b/libheaptrack.cpp index 8fab2b3..b6b0d09 100644 --- a/libheaptrack.cpp +++ b/libheaptrack.cpp @@ -41,6 +41,7 @@ #include #include "tracetree.h" +#include "config.h" /** * uncomment this to get extended debug code for known pointers @@ -298,8 +299,8 @@ void heaptrack_init(const char *outputFileName_, void (*initCallbackBefore) (), 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)) { +#if HAVE_UNW_SET_CACHE_SIZE + if (unw_set_cache_size(unw_local_addr_space, 1024)) { fprintf(stderr, "Failed to set libunwind cache size.\n"); } #endif