Defines for turning off fatal handling for signals

This commit is contained in:
Kjell Hedstrom 2015-02-18 04:06:22 -07:00
parent fc1acd742d
commit 7aea18edea
2 changed files with 39 additions and 10 deletions

View File

@ -28,21 +28,51 @@ ENDIF(CHANGE_G3LOG_DEBUG_TO_DBUG)
# WINDOWS OPTION
# -DENABLE_FATAL_SIGNALHANDLING=ON : defualt change the
# By default fatal signal handling is enabled. You can disable it with this option
# enumerated in src/stacktrace_windows.cpp
option (ENABLE_FATAL_SIGNALHANDLING
"Vectored exception / crash handling with improved stack trace" ON)
IF(NOT ENABLE_FATAL_SIGNALHANDLING)
add_definitions(-DDISABLE_FATAL_SIGNALHANDLING)
MESSAGE("-DENABLE_FATAL_SIGNALHANDLING=OFF\t\t\tFatal signal handler is disabled")
ELSE()
MESSAGE("-DENABLE_FATAL_SIGNALHANDLING=ON\t\t\tFatal signal handler is enabled")
ENDIF(NOT ENABLE_FATAL_SIGNALHANDLING)
# WINDOWS OPTIONS
IF (MSVC OR MINGW)
# -DENABLE_VECTORED_EXCEPTIONHANDLING=ON : defualt change the
# By default vectored exception handling is enabled, you can disable it with this option.
# Please know that only known fatal exceptions will be caught, these exceptions are the ones
# enumerated in src/stacktrace_windows.cpp
IF (MSVC OR MINGW)
option (ENABLE_VECTORED_EXCEPTIONHANDLING
"Vectored exception / crash handling with improved stack trace" ON)
IF(NOT ENABLE_VECTORED_EXCEPTIONHANDLING)
IF(NOT ENABLE_VECTORED_EXCEPTIONHANDLING)
add_definitions(-DDISABLE_VECTORED_EXCEPTIONHANDLING)
MESSAGE("-DENABLE_VECTORED_EXCEPTIONHANDLING=OFF")
MESSAGE("\tVectored exception handling is disabled")
MESSAGE("-DENABLE_VECTORED_EXCEPTIONHANDLING=OFF\t\t\tVectored exception handling is disabled")
ELSE()
MESSAGE("-DENABLE_VECTORED_EXCEPTIONHANDLING=ON")
MESSAGE("\tVectored exception handling is enabled")
MESSAGE("-DENABLE_VECTORED_EXCEPTIONHANDLING=ON\t\t\tVectored exception handling is enabled")
ENDIF(NOT ENABLE_VECTORED_EXCEPTIONHANDLING)
ENDIF (MSVC OR MINGW)
# Default ON. Will trigger a break point in DEBUG builds if the signal handler
# receives a fatal signal.
#
option (DEBUG_BREAK_AT_FATAL_SIGNAL
"Enable Visual Studio break point when receiving a fatal exception. In __DEBUG mode only" ON)
IF(DEBUG_BREAK_AT_FATAL_SIGNAL)
add_definitions(-DDEBUG_BREAK_AT_FATAL_SIGNAL)
MESSAGE("-DDEBUG_BREAK_AT_FATAL_SIGNAL=ON\t\t\tBreak point for fatal signal is enabled for __DEBUG")
ELSE()
MESSAGE("-DDEBUG_BREAK_AT_FATAL_SIGNAL=OFF\t\t\tBreak point for fatal signal is disabled")
ENDIF(DEBUG_BREAK_AT_FATAL_SIGNAL)
ENDIF (MSVC OR MINGW)

View File

@ -15,8 +15,7 @@
IF (USE_FATAL_EXAMPLE)
MESSAGE("-DUSE_FATAL_EXAMPLE=ON")
MESSAGE("\tg3log-FATAL- [contract][sigsegv][choice] are examples of when g3log comes in handy")
MESSAGE("-DUSE_FATAL_EXAMPLE=ON\t\t\tg3log-FATAL- [contract][sigsegv][choice] are examples of when g3log comes in handy")
include_directories (${DIR_EXAMPLE})
add_executable(g3log-FATAL-contract ${DIR_EXAMPLE}/main_contract.cpp)
add_executable(g3log-FATAL-sigsegv ${DIR_EXAMPLE}/main_sigsegv.cpp)