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

Add a way of printing a C backtrace to faulthandler #127604

Open
jakkdl opened this issue Dec 4, 2024 · 3 comments
Open

Add a way of printing a C backtrace to faulthandler #127604

jakkdl opened this issue Dec 4, 2024 · 3 comments
Labels
extension-modules C modules in the Modules dir type-feature A feature request or enhancement

Comments

@jakkdl
Copy link

jakkdl commented Dec 4, 2024

Feature or enhancement

Proposal:

The faulthandler module allows registering a SIGSEGV handler to print a Python stacktrace if the program encounters a segfault. However, if developing C/C++ extension modules that may not be particularly useful on its own, and you also want the the C stacktrace.
The suggested API would be a kwarg to faulthandler.enable().

Implementation could use https://github.com/timmaxw/cfaulthandler as a starting point, timmaxw/cfaulthandler@561dbdd in particular.

The availability/usability of the feature would likely depend on platform and/or compile flags.

Has this already been discussed elsewhere?

I have already discussed this feature proposal on Discourse

Links to previous discussion of this feature:

https://discuss.python.org/t/print-c-stacktrace-with-faulthandler/56834
where @gpshead approved of opening a feature request

Linked PRs

@jakkdl jakkdl added the type-feature A feature request or enhancement label Dec 4, 2024
@ZeroIntensity
Copy link
Member

Would you like to submit the starting PR?

@picnixz picnixz added the extension-modules C modules in the Modules dir label Dec 7, 2024
@jakkdl
Copy link
Author

jakkdl commented Dec 9, 2024

Would you like to submit the starting PR?

I might give it a try, but if anybody else wants to you're super welcome. I'm not especially well versed with faulthandler myself.

@ZeroIntensity
Copy link
Member

I went ahead and tried this myself: #128159

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension-modules C modules in the Modules dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants