jeremy-rifkin / cpptrace

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

Do you support stack traces from all threads? #136

Closed ggarra13 closed 2 months ago

ggarra13 commented 2 months ago

I am mainly interested in Linux, but Windows support would be nice too.

jeremy-rifkin commented 2 months ago

Hi, you can generate a trace from any thread and tracing is thread-safe. Currently cpptrace doesn't support any way to generate a trace for another thread, if that's what you refer to. I've looked into supporting that but it's tricky, this also came up in #135.

jeremy-rifkin commented 2 months ago

I'll go ahead and close for now, please let me know if there's anything else!

jeremy-rifkin commented 2 months ago

I'll quickly add, if you are interested in getting the stacktrace of another thread on linux, most implementations I've seen for this involve sending SIGUSR1/SIGUSR2 to the thread you want to trace with pthread_kill. It should be possible to use cpptrace's signal-safe trace support in this handler, though there are a lot of choices for how one could go about trying to do the resolution and pass information around.