jeremy-rifkin / cpptrace

Simple, portable, and self-contained stacktrace library for C++11 and newer
MIT License
621 stars 64 forks source link

[documentation] clarification about the signal safe stack tracing #146

Closed bertulli closed 1 month ago

bertulli commented 1 month ago

Hi, first of all thanks for your work. I was trying to integrate cpptrace in my project to investigate signal faults (specifically SIGSEGV), and I noticed a few things:

As a side note, it's mentioned in #126 that older versions of glibc can't print the traces: do you know what is the minimum version?

Thanks!

jeremy-rifkin commented 1 month ago

Hi, thanks for pointing out the broken links. I’ll fix them tonight (or accept a PR), the files are in https://github.com/jeremy-rifkin/cpptrace/tree/main/test. The count in question comes from the generate safe raw trace function,

std::size_t count = cpptrace::safe_generate_raw_trace(…);

The minimum glibc version is 2.35, released in early 2022. Unfortunately it’s a relatively high glibc requirement but _dl_find_object is the only way to do this in a truly signal-safe way, as far as I have found.

jeremy-rifkin commented 1 month ago

I've pushed some fixes to the documentation in e8fce3fad1d299bb4effbe5af701bbc9bbd10ab5