compat.cpptrace
#includecpptrace — simple, portable stack traces for C++
#include <cpptrace/cpptrace.hpp>
mcpp add compat.cpptrace@1.0.4
Usage
From this repository's own test project — built and run by CI, not written for the website.
// Behavioral test — compat.cpptrace unwinds a real call stack.
//
// What is asserted is deliberately what the CHOSEN BACKENDS can answer on a
// bare CI runner. The package selects `_Unwind_Backtrace` + `dladdr` on unix
// and DbgHelp on windows, all dependency-free, and the documented cost of that
// choice is that frames carry no file:line (dladdr does not read DWARF). So
// this test asserts the unwinder — frame count and distinct return addresses —
// and never asserts on line numbers, which would be testing libdwarf's absence
// rather than this package.
#include <cpptrace/cpptrace.hpp>
#include <cpptrace/version.hpp>
#include <cstdio>
#include <cstdint>
#if CPPTRACE_VERSION != CPPTRACE_TO_VERSION(1, 0, 4)
# error "cpptrace/version.hpp does not describe 1.0.4 — the generated header drifted from the tarball"
#endif
// The package builds objects, not a shared library, so every cpptrace
// declaration this TU sees must be plain — not dllimport, not
// visibility("default"). The package delivers that with a shim in front of
// …
tests/examples/cpptrace/tests/trace.cpp · project tests/examples/cpptrace
Build
- targets
cpptrace (lib)- language
c++23- C standard
c11- import std
- no
- include dirs
mcpp_generated, */include, */src
Sources (1)
*/src/**/*.cpp
Generated files
mcpp_generated/cpptrace/version.hppmcpp_generated/cpptrace/basic.hpp