8000 bpo-29673: fix gdb scripts pystack and pystackv (GH-6126) · python/cpython@3a9ccee · GitHub
[go: up one dir, main page]

Skip to content

Commit 3a9ccee

Browse files
Marcel Plchned-deily
authored andcommitted
bpo-29673: fix gdb scripts pystack and pystackv (GH-6126)
1 parent 1d87c7b commit 3a9ccee

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,7 @@ Zero Piraeus
12501250
Antoine Pitrou
12511251
Jean-François Piéronne
12521252
Oleg Plakhotnyuk
1253+
Marcel Plch
12531254
Remi Pointel
12541255
Jon Poler
12551256
Ariel Poliak
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix pystackv and pystack gdbinit macros.

Misc/gdbinit

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ define pylocals
4242
set $_i = 0
4343
while $_i < f->f_code->co_nlocals
4444
if f->f_localsplus + $_i != 0
45-
set $_names = co->co_varnames
46-
set $_name = _PyUnicode_AsString(PyTuple_GetItem($_names, $_i))
45+
set $_names = f->f_code->co_varnames
46+
set $_name = PyUnicode_AsUTF8(PyTuple_GetItem($_names, $_i))
4747
printf "%s:\n", $_name
4848
pyo f->f_localsplus[$_i]
4949
end
@@ -84,8 +84,8 @@ define pyframev
8484
end
8585

8686
define pyframe
87-
set $__fn = _PyUnicode_AsString(co->co_filename)
88-
set $__n = _PyUnicode_AsString(co->co_name)
87+
set $__fn = PyUnicode_AsUTF8(f->f_code->co_filename)
88+
set $__n = PyUnicode_AsUTF8(f->f_code->co_name)
8989
printf "%s (", $__fn
9090
lineno
9191
printf "): %s\n", $__n
@@ -110,7 +110,7 @@ end
110110
#end
111111

112112
define printframe
113-
if $pc > PyEval_EvalFrameEx && $pc < PyEval_EvalCodeEx
113+
if $pc > PyEval_EvalFrameEx && $pc < _PyEval_EvalFrameDefault
114114
pyframe
115115
else
116116
frame
@@ -139,7 +139,7 @@ document pystack
139139
end
140140
define pystack
141141
while $pc < Py_Main || $pc > Py_GetArgcArgv
142-
if $pc > PyEval_EvalFrameEx && $pc < PyEval_EvalCodeEx
142+
if $pc > PyEval_EvalFrameEx && $pc < _PyEval_EvalFrameDefault
143143
pyframe
144144
end
145145
up-silently 1
@@ -152,7 +152,7 @@ document pystackv
152152
end
153153
define pystackv
154154
while $pc < Py_Main || $pc > Py_GetArgcArgv
155-
if $pc > PyEval_EvalFrameEx && $pc < PyEval_EvalCodeEx
155+
if $pc > PyEval_EvalFrameEx && $pc < _PyEval_EvalFrameDefault
156156
pyframev
157157
end
158158
up-silently 1

Python/ceval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3661,7 +3661,7 @@ too_many_positional(PyCodeObject *co, Py_ssize_t given, Py_ssize_t defcount,
36613661
}
36623662

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

36673667
PyObject *

0 commit comments

Comments
 (0)
0