-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
gh-127604: Add C stack dumps to faulthandler
#128159
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some PEP-7 nits but I don't know if this was done to be aligned with the rest of the code so you can freely ignore those nits.
@ZeroIntensity If you ever use the web UI, don't forget to replace my tabs with spaces... hopefully your IDE does it but I see that I have tabs instead of spaces on my suggestions (I've corrected them but just double-check) |
Co-authored-by: Bénédikt Tran <[email protected]>
…thon into c-faulthandler
Co-authored-by: Bénédikt Tran <[email protected]>
…thon into c-faulthandler
🤖 New build scheduled with the buildbot fleet by @ZeroIntensity for commit e79e661 🤖 If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I did start playing around with an implementation myself, and looks like we made a couple different implementation decisions:
Instead of adding a dump_c_stack
function, I added a kwarg to dump_traceback
. I think I prefer your approach here, since a user may want to see the c backtrace but doesn't care about the python traceback. Though that does clash somewhat with it being a kwarg to enable
(and register
/dump_traceback_later
).
I named my kwarg c_backtrace
, though I think I prefer c_stack
to avoid backtrace/traceback confusion.
I also added a kwarg to register()
, and dump_traceback_later
could also get it.
I made all functions raise an exception if passed c_stack=True
and it wasn't available, and added a global faulthandler.HAS_C_BACKTRACE
. I'm not sure what the best approach is here.
This only adds it for glibc right now. I think it's possible to implement it for Windows with
StackWalk64
, but I'd prefer to get a solid working implementation for other systems before I dive into that.faulthandler
#127604📚 Documentation preview 📚: https://cpython-previews--128159.org.readthedocs.build/en/128159/library/faulthandler.html#dumping-the-c-stack