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(
${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)
--- /dev/null
+/*
+ * 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
#include <boost/algorithm/string/replace.hpp>
#include "tracetree.h"
+#include "config.h"
/**
* uncomment this to get extended debug code for known pointers
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