Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow tracing of stack given a signal handler's context #414

Open
s1341 opened this issue Apr 7, 2021 · 2 comments
Open

Allow tracing of stack given a signal handler's context #414

s1341 opened this issue Apr 7, 2021 · 2 comments

Comments

@s1341
Copy link

s1341 commented Apr 7, 2021

It would be really convenient to be able to trace the stack starting with a signal-handler's context, at least on posix platforms which support this.

Is there a way to do this currently? Are you open to accepting a PR to allow this?

@alexcrichton
Copy link
Member

Sorry for taking awhile to respond to this.

I do not personally really want to maintain bindings safe to get a stack trace from a signal handler. I honestly don't really know what that would entail. We call into libunwind and I have no idea what we need to do to make libunwind safe to run from a signal handler context.

I'm open to the idea of supporting this but this would need to be extremely carefully done and documented. I do not think this is a task to take on lightly, and ideally someone who's already an expert at signal handling and stack traces would take this on.

None of the existing code in this crate has been written to be safe to execute from a signal handler's context. This would need a pretty close audit to exactly specific what can and what can't be invoked from such a context.

@bjorn3
Copy link
Member

bjorn3 commented Jun 18, 2021

According to https://www.nongnu.org/libunwind/man/libunwind(3).html all methods necessary for unwinding of the current thread (as opposed to a different thread of process) are signal safe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants