This repository was archived by the owner on Mar 22, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ option(CHECK_CPP_STYLE "check code style of C++ sources" OFF)
7878option (TRACE_TESTS "more verbose test outputs" OFF )
7979option (USE_ASAN "enable AddressSanitizer (debugging)" OFF )
8080option (USE_UBSAN "enable UndefinedBehaviorSanitizer (debugging)" OFF )
81+ option (USE_LIBUNWIND "use libunwind for more reliable stack traces from tests (if available)" ON )
8182option (USE_CCACHE "use ccache if it is available in the system" ON )
8283
8384option (TESTS_USE_FORCED_PMEM "run tests with PMEM_IS_PMEM_FORCE=1 - it speeds up tests execution on emulated pmem" OFF )
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ include(tbb)
8181
8282add_library (test_backtrace STATIC test_backtrace.c )
8383if (LIBUNWIND_FOUND)
84- target_compile_definitions (test_backtrace PUBLIC USE_LIBUNWIND =1 )
84+ target_compile_definitions (test_backtrace PUBLIC LIBUNWIND_ENABLED =1 )
8585endif ()
8686
8787add_library (valgrind_internal STATIC valgrind_internal.cpp )
Original file line number Diff line number Diff line change @@ -34,13 +34,17 @@ function(find_packages)
3434 find_package (Curses QUIET )
3535 endif ()
3636
37- if (PKG_CONFIG_FOUND)
38- pkg_check_modules (LIBUNWIND QUIET libunwind )
39- else ()
40- find_package (LIBUNWIND QUIET )
41- endif ()
42- if (NOT LIBUNWIND_FOUND)
43- message (WARNING "libunwind not found. Stack traces from tests will not be reliable" )
37+ if (USE_LIBUNWIND)
38+ if (PKG_CONFIG_FOUND)
39+ pkg_check_modules (LIBUNWIND QUIET libunwind )
40+ else ()
41+ find_package (LIBUNWIND QUIET )
42+ endif ()
43+ if (NOT LIBUNWIND_FOUND)
44+ message (WARNING "libunwind not found. Stack traces from tests will not be reliable" )
45+ else ()
46+ message (STATUS "Found libunwind: ${LIBUNWIND_LIBDIR} (version: ${LIBUNWIND_VERSION} )" )
47+ endif ()
4448 endif ()
4549
4650 find_gdb ()
Original file line number Diff line number Diff line change 11// SPDX-License-Identifier: BSD-3-Clause
2- /* Copyright 2015-2019 , Intel Corporation */
2+ /* Copyright 2015-2021 , Intel Corporation */
33
44/*
55 * backtrace.c -- backtrace reporting routines
1616#include <stdlib.h>
1717#include <string.h>
1818
19- #ifdef USE_LIBUNWIND
19+ #ifdef LIBUNWIND_ENABLED
2020
2121#define UNW_LOCAL_ONLY
2222#include <dlfcn.h>
@@ -90,7 +90,7 @@ test_dump_backtrace(void)
9090 unw_strerror (ret ), ret );
9191 }
9292}
93- #else /* USE_LIBUNWIND */
93+ #else /* LIBUNWIND_ENABLED */
9494
9595#define BSIZE 100
9696
@@ -162,7 +162,7 @@ test_dump_backtrace(void)
162162
163163#endif /* _WIN32 */
164164
165- #endif /* USE_LIBUNWIND */
165+ #endif /* LIBUNWIND_ENABLED */
166166
167167/*
168168 * test_sighandler -- fatal signal handler
You can’t perform that action at this time.
0 commit comments