diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-04-06 22:14:29 (GMT) |
---|---|---|
committer | Ned Deily <nad@python.org> | 2018-04-06 22:14:29 (GMT) |
commit | 3c193cf8afce525b1283986f113de0e16f23e115 (patch) | |
tree | 07dae4b7a3bd84a56c7dfa6c88c0b714000a6b86 | |
parent | 252f10cbac0132924faed8de44ed7b15e774cbcb (diff) | |
download | cpython-3c193cf8afce525b1283986f113de0e16f23e115.zip cpython-3c193cf8afce525b1283986f113de0e16f23e115.tar.gz cpython-3c193cf8afce525b1283986f113de0e16f23e115.tar.bz2 |
[3.7] bpo-29673: fix gdb scripts pystack and pystackv (GH-6126) (GH-6399)
(cherry picked from commit 3a9ccee0e5dbf7d67f5ab79f6095755969db117c)
Co-authored-by: Marcel Plch <gmarcel.plch@gmail.com>
-rw-r--r-- | Misc/ACKS | 1 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Tools-Demos/2018-03-16-17-25-05.bpo-29673.m8QtaW.rst | 1 | ||||
-rw-r--r-- | Misc/gdbinit | 14 | ||||
-rw-r--r-- | Python/ceval.c | 2 |
4 files changed, 10 insertions, 8 deletions
@@ -1248,6 +1248,7 @@ Zero Piraeus Antoine Pitrou Jean-François Piéronne Oleg Plakhotnyuk +Marcel Plch Remi Pointel Jon Poler Ariel Poliak diff --git a/Misc/NEWS.d/next/Tools-Demos/2018-03-16-17-25-05.bpo-29673.m8QtaW.rst b/Misc/NEWS.d/next/Tools-Demos/2018-03-16-17-25-05.bpo-29673.m8QtaW.rst new file mode 100644 index 0000000..3d515b3 --- /dev/null +++ b/Misc/NEWS.d/next/Tools-Demos/2018-03-16-17-25-05.bpo-29673.m8QtaW.rst @@ -0,0 +1 @@ +Fix pystackv and pystack gdbinit macros. diff --git a/Misc/gdbinit b/Misc/gdbinit index 3b6fe50..bb10bdb 100644 --- a/Misc/gdbinit +++ b/Misc/gdbinit @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/Python/ceval.c b/Python/ceval.c index b37205e..df5c093 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3650,7 +3650,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). */ PyObject * |