Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 44c19f6

Browse files
committed
Get gdb macros working with unicode and PyVarObject change
1 parent 1e93f2b commit 44c19f6

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Misc/gdbinit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ define pylocals
3232
while $_i < f->f_nlocals
3333
if f->f_localsplus + $_i != 0
3434
set $_names = co->co_varnames
35-
set $_name = PyString_AsString(PyTuple_GetItem($_names, $_i))
35+
set $_name = PyUnicode_AsString(PyTuple_GetItem($_names, $_i))
3636
printf "%s:\n", $_name
3737
# side effect of calling _PyObject_Dump is to dump the object's
3838
# info - assigning just prevents gdb from printing the
@@ -49,7 +49,7 @@ define lineno
4949
set $__continue = 1
5050
set $__co = f->f_code
5151
set $__lasti = f->f_lasti
52-
set $__sz = ((PyStringObject *)$__co->co_lnotab)->ob_size/2
52+
set $__sz = ((PyVarObject *)$__co->co_lnotab)->ob_size/2
5353
set $__p = (unsigned char *)((PyStringObject *)$__co->co_lnotab)->ob_sval
5454
set $__li = $__co->co_firstlineno
5555
set $__ad = 0
@@ -74,7 +74,7 @@ end
7474

7575
define pyframe
7676
set $__fn = (char *)((PyStringObject *)co->co_filename)->ob_sval
77-
set $__n = (char *)((PyStringObject *)co->co_name)->ob_sval
77+
set $__n = PyUnicode_AsString(co->co_name)
7878
printf "%s (", $__fn
7979
lineno
8080
printf "): %s\n", $__n

0 commit comments

Comments
 (0)