Skip to content

Repository files navigation

cpptrace_th: Customizable terminate handler register for cpptrace

Features

  • Automatically register a terminate handler that prints a stack trace (provided by cpptrace) when a program terminates unexpectedly.
  • Customizable stack trace output format.
    • Option to print code snippets around the stack trace. (Default: ON)
    • Option to skip stackframes from the top of the stack trace by regex matching. (Default: skip till std::terminate)
  • Option to disable zstd prerequisite in cpptrace. (Default: ON)

Usage

FetchContent_Declare(
cpptrace_th
GIT_REPOSITORY"https://github.com/Lei-workshop/cpptrace_th"GIT_TAG"main"GIT_SHALLOWONGIT_PROGRESSTRUESYSTEM)
FetchContent_MakeAvailable(cpptrace_th)
target_link_libraries(your_targetPRIVATEcpptrace_th::static)
# ORtarget_link_libraries(your_targetPRIVATEcpptrace_th::shared)

Customization

cpptrace_th can be customized by cmake variables (compile-time) or by setting environment variables (run-time). Run-time environment variables take precedence over compile-time cmake variables.

variableexplanationdefaultcmakeenvironment
CPPTRACE_TH_BUILD_EXAMPLEPrint code snippets in traceON
CPPTRACE_TH_ENABLE_SKIPEnable skip regexON
CPPTRACE_TH_SKIP_REGEXFrames before matched regex (included) will be omitted\bstd::terminate\b
CPPTRACE_TH_NO_ZSTDRemove ZSTD support (speedup build)ON

About

customizable terminate handler register for cpptrace

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages