r/cpp • • Apr 16 '26

C++23 std::stacktrace: Never Debug Blind Again

https://medium.com/@sagar.necindia/c-23-std-stacktrace-never-debug-blind-again-6625924d520c
75 Upvotes

48 comments sorted by

View all comments

Show parent comment

3

u/schmerg-uk Apr 16 '26

See https://github.com/jeremy-rifkin/cpptrace/tree/main for example (we have our own so I did mention a couple of things to the author but his work now way exceeds the one we use internally)

Oh, and he does address

What about C++23 <stacktrace>?

Some day C++23's <stacktrace> will be ubiquitous. And maybe one day the msvc implementation will be acceptable. The original motivation for cpptrace was to support projects using older C++ standards and as the library has grown its functionality has extended beyond the standard library's implementation.

Cpptrace provides functionality beyond what the standard library provides and what implementations provide, such as:

Walking inlined function calls
Providing a lightweight interface for "raw traces"
Resolving function parameter types
Providing traced exception objects
Providing an API for signal-safe stacktrace generation
Providing a way to retrieve stack traces from arbitrary exceptions, not just special cpptrace traced exception objects. This is a feature that has been proposed for a future version of the C++ standard, but cpptrace provides a solution for C++11.