Print stack trace on exceptions

if libunwind is found.

Useful for debugging logs.
This commit is contained in:
moneromooo-monero
2016-03-28 19:00:18 +01:00
parent ef4ff4252a
commit e409e59d29
5 changed files with 188 additions and 2 deletions

View File

@@ -243,6 +243,14 @@ endif()
add_definitions("-DBLOCKCHAIN_DB=${BLOCKCHAIN_DB}")
find_package(Libunwind)
if(LIBUNWIND_FOUND)
message(STATUS "Using libunwind to provide stack traces")
add_definitions("-DHAVE_LIBUNWIND")
else()
message(STATUS "Stack traces disabled")
endif()
if (UNIX AND NOT APPLE)
# Note that at the time of this writing the -Wstrict-prototypes flag added below will make this fail
set(THREADS_PREFER_PTHREAD_FLAG ON)
@@ -274,6 +282,10 @@ if (BERKELEY_DB)
include_directories(${BDB_INCLUDE})
endif()
# Final setup for libunwind
include_directories(${LIBUNWIND_INCLUDE})
link_directories(${LIBUNWIND_LIBRARY_DIRS})
if(MSVC)
add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /FIinline_c.h /D__SSE4_1__")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Dinline=__inline")
@@ -394,6 +406,7 @@ else()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_FLAGS}")
if(STATIC AND NOT APPLE AND NOT FREEBSD AND NOT OPENBSD)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--wrap=__cxa_throw")
endif()
endif()
@@ -431,6 +444,11 @@ elseif(NOT MSVC)
set(EXTRA_LIBRARIES ${RT})
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
find_library(DL dl)
set(EXTRA_LIBRARIES ${DL})
endif()
include(version.cmake)
add_subdirectory(contrib)