mcpp index

compat.cpptrace

#include

cpptrace — simple, portable stack traces for C++

#include <cpptrace/cpptrace.hpp>
mcpp add compat.cpptrace@1.0.4

用法

来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。

// 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 · 项目 tests/examples/cpptrace

构建

targets
cpptrace (lib)
language
c++23
C standard
c11
import std
no
include dirs
mcpp_generated, */include, */src

源文件 (1)

  • */src/**/*.cpp

生成的文件

  • mcpp_generated/cpptrace/version.hpp
  • mcpp_generated/cpptrace/basic.hpp

版本

版本平台 镜像sha256
1.0.4 最新 LinuxWindowsmacOS CN GLOBAL 5c9f5b301e90…