Adapt to libunwind changes with unw_set_cache_size.
authorMilian Wolff <mail@milianw.de>
Thu, 11 Dec 2014 13:32:59 +0000 (14:32 +0100)
committerMilian Wolff <mail@milianw.de>
Thu, 11 Dec 2014 13:32:59 +0000 (14:32 +0100)
CMakeLists.txt
config.h.cmake [new file with mode: 0644]
libheaptrack.cpp

index 4ea2420..bd8c7c4 100644 (file)
@@ -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 (file)
index 0000000..eb14503
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2014 Milian Wolff <mail@milianw.de>
+ *
+ * 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
index 8fab2b3..b6b0d09 100644 (file)
@@ -41,6 +41,7 @@
 #include <boost/algorithm/string/replace.hpp>
 
 #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