Skip to content

[3.6] bpo-29673: fix gdb scripts pystack and pystackv (GH-6126) #6400

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 1 commit into from
Apr 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,7 @@ Zero Piraeus
Antoine Pitrou
Jean-François Piéronne
Oleg Plakhotnyuk
Marcel Plch
Remi Pointel
Jon Poler
Ariel Poliak
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix pystackv and pystack gdbinit macros.
14 changes: 7 additions & 7 deletions Misc/gdbinit
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ define pylocals
set $_i = 0
while $_i < f->f_code->co_nlocals
if f->f_localsplus + $_i != 0
set $_names = co->co_varnames
set $_name = _PyUnicode_AsString(PyTuple_GetItem($_names, $_i))
set $_names = f->f_code->co_varnames
set $_name = PyUnicode_AsUTF8(PyTuple_GetItem($_names, $_i))
printf "%s:\n", $_name
pyo f->f_localsplus[$_i]
end
Expand Down Expand Up @@ -76,8 +76,8 @@ define pyframev
end

define pyframe
set $__fn = _PyUnicode_AsString(co->co_filename)
set $__n = _PyUnicode_AsString(co->co_name)
set $__fn = PyUnicode_AsUTF8(f->f_code->co_filename)
set $__n = PyUnicode_AsUTF8(f->f_code->co_name)
printf "%s (", $__fn
lineno
printf "): %s\n", $__n
Expand All @@ -102,7 +102,7 @@ end
#end

define printframe
if $pc > PyEval_EvalFrameEx && $pc < PyEval_EvalCodeEx
if $pc > PyEval_EvalFrameEx && $pc < _PyEval_EvalFrameDefault
pyframe
else
frame
Expand All @@ -129,7 +129,7 @@ end
# print the entire Python call stack
define pystack
while $pc < Py_Main || $pc > Py_GetArgcArgv
if $pc > PyEval_EvalFrameEx && $pc < PyEval_EvalCodeEx
if $pc > PyEval_EvalFrameEx && $pc < _PyEval_EvalFrameDefault
pyframe
end
up-silently 1
Expand All @@ -140,7 +140,7 @@ end
# print the entire Python call stack - verbose mode
define pystackv
while $pc < Py_Main || $pc > Py_GetArgcArgv
if $pc > PyEval_EvalFrameEx && $pc < PyEval_EvalCodeEx
if $pc > PyEval_EvalFrameEx && $pc < _PyEval_EvalFrameDefault
pyframev
end
up-silently 1
Expand Down
2 changes: 1 addition & 1 deletion Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -3888,7 +3888,7 @@ too_many_positional(PyCodeObject *co, Py_ssize_t given, Py_ssize_t defcount,
}

/* This is gonna seem *real weird*, but if you put some other code between
PyEval_EvalFrame() and PyEval_EvalCodeEx() you will need to adjust
PyEval_EvalFrame() and _PyEval_EvalFrameDefault() you will need to adjust
the test in the if statements in Misc/gdbinit (pystack and pystackv). */

static PyObject *
Expand Down