A simple, portable, and self-contained C++ stacktrace library supporting C++11 and newer on Linux, macOS, and Windows.
Cpptrace is a portable C++ library for generating and analyzing stack traces, designed to work with C++11 and newer across Linux, macOS, and Windows. It solves the problem of difficult debugging by providing detailed call stack information, including source locations and inlining details, even from exceptions and signal handlers.
C++ developers working on cross-platform applications who need robust debugging tools for diagnosing crashes, exceptions, and performance issues, particularly in environments where standard stacktrace support is limited or unavailable.
Developers choose Cpptrace for its simplicity, portability, and comprehensive feature set—including exception tracing, signal-safe unwinding, and JIT support—without the complexity of other libraries or reliance on platform-specific tools.
Simple, portable, and self-contained stacktrace library for C++11 and newer
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Works on Linux, macOS, and Windows including MinGW and Cygwin, as demonstrated by the README's extensive platform support and CI badges.
Provides CPPTRACE_TRY/CATCH macros to capture stack traces from arbitrary exceptions with zero overhead in non-throwing paths, a unique feature highlighted in the exception tracing section.
Offers APIs for generating raw traces within signal handlers, which the README notes is a rare capability for crash debugging on supported systems like those with libunwind.
Supports source code snippets, inlining details, and multiple debug formats (DWARF, PDB, dSYM), enabling detailed trace output as shown in the demo images.
Relies on external libraries like libdwarf and libunwind, which can be difficult to install and may require specific versions, as mentioned in the installation and backend configuration sections.
On Windows, shared builds need manual DLL copying; on macOS, .dSYM file generation is recommended for full symbols, adding extra steps beyond basic compilation.
The CPPTRACE_TRY/CATCH macros restrict return statements within try blocks on Windows and can lead to misleading traces if mixed with standard catch handlers, as warned in the README.