mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-123967: Fix faulthandler for trampoline frames (#127329)
If the top-most frame is a trampoline frame, skip it.
(cherry picked from commit 58e334e143
)
This commit is contained in:
parent
c3bb32de9d
commit
f4c9f39165
2 changed files with 16 additions and 9 deletions
|
@ -1242,6 +1242,8 @@ done:
|
|||
static void
|
||||
dump_frame(int fd, _PyInterpreterFrame *frame)
|
||||
{
|
||||
assert(frame->owner != FRAME_OWNED_BY_CSTACK);
|
||||
|
||||
PyCodeObject *code = frame->f_code;
|
||||
PUTS(fd, " File ");
|
||||
if (code->co_filename != NULL
|
||||
|
@ -1315,24 +1317,27 @@ dump_traceback(int fd, PyThreadState *tstate, int write_header)
|
|||
|
||||
unsigned int depth = 0;
|
||||
while (1) {
|
||||
if (frame->owner == FRAME_OWNED_BY_CSTACK) {
|
||||
/* Trampoline frame */
|
||||
frame = frame->previous;
|
||||
if (frame == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Can't have more than one shim frame in a row */
|
||||
assert(frame->owner != FRAME_OWNED_BY_CSTACK);
|
||||
}
|
||||
|
||||
if (MAX_FRAME_DEPTH <= depth) {
|
||||
PUTS(fd, " ...\n");
|
||||
break;
|
||||
}
|
||||
|
||||
dump_frame(fd, frame);
|
||||
frame = frame->previous;
|
||||
if (frame == NULL) {
|
||||
break;
|
||||
}
|
||||
if (frame->owner == FRAME_OWNED_BY_CSTACK) {
|
||||
/* Trampoline frame */
|
||||
frame = frame->previous;
|
||||
}
|
||||
if (frame == NULL) {
|
||||
break;
|
||||
}
|
||||
/* Can't have more than one shim frame in a row */
|
||||
assert(frame->owner != FRAME_OWNED_BY_CSTACK);
|
||||
depth++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue