From: Wolfram Sang Date: Fri, 17 Apr 2020 13:43:27 +0000 (+0200) Subject: Add stacktrace support X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=b409dfdc01ed36b54f5b8a70b3738146a26bf37e;p=pulseview.git Add stacktrace support Use backtrace when available, otherwise the basic stacktracer. This fixes bug #1150. Signed-off-by: Wolfram Sang --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ecaf6694..e157e7db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,6 +123,14 @@ if(ENABLE_TESTS) endif() if(ENABLE_STACKTRACE) + include(FindBacktrace) + if (Backtrace_FOUND) + set(_Boost_STACKTRACE_BACKTRACE_HEADERS "boost/stacktrace.hpp") + list(APPEND BOOSTCOMPS stacktrace_backtrace) + else() + set(_Boost_STACKTRACE_BASIC_HEADERS "boost/stacktrace.hpp") + list(APPEND BOOSTCOMPS stacktrace_basic) + endif() find_package(Boost 1.65.1 COMPONENTS ${BOOSTCOMPS} REQUIRED) else() find_package(Boost 1.55 COMPONENTS ${BOOSTCOMPS} REQUIRED) @@ -465,7 +473,10 @@ if(ENABLE_SIGNALS) endif() if(ENABLE_STACKTRACE) - add_definitions(-DENABLE_STACKTRACE) + add_definitions(-DENABLE_STACKTRACE -no-pie -fno-pie) + if (Backtrace_FOUND) + add_definitions(-DBOOST_STACKTRACE_USE_BACKTRACE) + endif() endif() #=============================================================================== @@ -520,8 +531,8 @@ if(WIN32) endif() if(ENABLE_STACKTRACE) - # Needed to resolve dladdr. - list(APPEND PULSEVIEW_LINK_LIBS "-ldl") + list(APPEND PULSEVIEW_LINK_LIBS ${CMAKE_DL_LIBS} ${Backtrace_LIBRARIES}) + link_libraries("-no-pie -fno-pie") endif() if(ANDROID)