Skip to content

gh-127604: Add C stack dumps to faulthandler #128159

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

Merged
merged 57 commits into from
Apr 21, 2025
Merged
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
0ebdc69
Initial implementation for glibc
ZeroIntensity Dec 21, 2024
0ccf9fb
Make it cross-platform buildable.
ZeroIntensity Dec 21, 2024
52945e5
Call it on Windows.
ZeroIntensity Dec 21, 2024
9bdd802
Add a whatsnew entry
ZeroIntensity Dec 21, 2024
66f2641
Add dump_c_stack
ZeroIntensity Dec 21, 2024
0591013
Reverse the loop.
ZeroIntensity Dec 21, 2024
64707a2
Add documentation entries.
ZeroIntensity Dec 21, 2024
8a5b784
Make the whatsnew entry more specific.
ZeroIntensity Dec 21, 2024
4f09358
Add tests.
ZeroIntensity Dec 21, 2024
e1aa619
Add blurb from whatsnew.
ZeroIntensity Dec 21, 2024
6b515d3
Fix failing Sphinx build.
ZeroIntensity Dec 21, 2024
c69ee9d
Fix PyArg_ParseTupleAndKeywords format string.
ZeroIntensity Dec 21, 2024
f08b1dd
Fix Sphinx warnings.
ZeroIntensity Dec 21, 2024
dbb6d25
Add ignore to test_inspect
ZeroIntensity Dec 21, 2024
faf1a3e
Fix name.
ZeroIntensity Dec 21, 2024
ec832aa
Ignore the reentrant variable in the C analyzer.
ZeroIntensity Dec 21, 2024
524f167
Apply suggestions from code review
ZeroIntensity Dec 21, 2024
dd08bcb
Use manpage references.
ZeroIntensity Dec 21, 2024
bda3dcd
Add issue number to whatsnew.
ZeroIntensity Dec 21, 2024
a3564a5
Merge branch 'c-faulthandler' of https://github.com/ZeroIntensity/cpy…
ZeroIntensity Dec 21, 2024
f3fcea1
Rename macros.
ZeroIntensity Dec 21, 2024
db97dd2
Reduce number of printed calls.
ZeroIntensity Dec 21, 2024
c17457f
Apply suggestions from code review
ZeroIntensity Dec 21, 2024
d5f7d4b
Address code review.
ZeroIntensity Dec 21, 2024
e79e661
Merge branch 'c-faulthandler' of https://github.com/ZeroIntensity/cpy…
ZeroIntensity Dec 21, 2024
0c84f8a
Explicitly check for backtrace() and backtrace_symbols()
ZeroIntensity Dec 22, 2024
8198997
Handle no frames returned.
ZeroIntensity Dec 22, 2024
0f670f0
Move the function that calls backtrace() to within the core.
ZeroIntensity Dec 25, 2024
079f186
Merge into main.
ZeroIntensity Jan 26, 2025
892a085
Fix test case.
ZeroIntensity Jan 26, 2025
896abd1
Run make regen-configure
ZeroIntensity Jan 26, 2025
cab079e
Extract behavior in own function.
ZeroIntensity Jan 27, 2025
1784071
PEP-7
ZeroIntensity Jan 27, 2025
3304e2a
Update pycore_traceback.h
ZeroIntensity Feb 4, 2025
aa97f24
Use address_expr
ZeroIntensity Feb 5, 2025
50b4964
Fix wrong argument parsing keycode.
ZeroIntensity Feb 5, 2025
533b1db
Add tests for dump_c_stack()
ZeroIntensity Feb 5, 2025
58b3580
Start homemade implementation of backtrace_symbols()
ZeroIntensity Feb 26, 2025
f62dac8
Merge branch 'main' into c-faulthandler
ZeroIntensity Mar 31, 2025
4feaf09
Fix merge conflicts.
ZeroIntensity Apr 13, 2025
c95369f
Merge branch 'c-faulthandler' of https://github.com/ZeroIntensity/cpy…
ZeroIntensity Apr 13, 2025
95833e7
Untested implementation.
ZeroIntensity Apr 13, 2025
3e2701d
Sorta works.
ZeroIntensity Apr 13, 2025
56127fa
NULL-initialize the arrays.
ZeroIntensity Apr 13, 2025
b70bd43
Use dprintf()
ZeroIntensity Apr 13, 2025
7a070ab
Add proper configure guards.
ZeroIntensity Apr 13, 2025
e9c3d7c
Use faulthandler formatting.
ZeroIntensity Apr 13, 2025
195a539
Protect against compilers without VLAs.
ZeroIntensity Apr 13, 2025
9dd6c3b
Fix incorrect formatting when no symbol name is available.
ZeroIntensity Apr 13, 2025
ce9c39f
Don't use GNU extension.
ZeroIntensity Apr 13, 2025
c344ad7
Handle NULL.
ZeroIntensity Apr 13, 2025
e899792
Fix newlines in the whatsnew.
ZeroIntensity Apr 14, 2025
b136f71
Fix stray newline change.
ZeroIntensity Apr 14, 2025
2c381b9
Add configure guard for dladdr1()
ZeroIntensity Apr 14, 2025
52c0748
Add documentation about compatibility.
ZeroIntensity Apr 14, 2025
bd47026
Fix sphinx role.
ZeroIntensity Apr 14, 2025
07a20d0
Fix styling.
ZeroIntensity Apr 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix wrong argument parsing keycode.
  • Loading branch information
ZeroIntensity committed Feb 5, 2025
commit 50b4964c96e73ba787b72c7ba74b0fdbd559dc86
4 changes: 2 additions & 2 deletions Modules/faulthandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,13 @@ faulthandler_dump_traceback_py(PyObject *self,

static PyObject *
faulthandler_dump_c_stack_py(PyObject *self,
PyObject *args, PyObject *kwargs)
PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = {"file", NULL};
PyObject *file = NULL;

if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|p:dump_c_stack", kwlist,
"|O:dump_c_stack", kwlist,
&file))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PEP 7: add braces

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this got brought up before. The rest of the file avoids the braces, it's probably better to just stay consistent.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I respectfully disagree, we are adding new functions so it's better to go closer to the standard that deviate more from it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the author of the original code, I would prefer that new code respects PEP 7 (add braces) :-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do. cc @picnixz if you want to bicker about styling (I'm pretty sure you were the one that originally brought this up).

return NULL;

Expand Down