1414# with embedded macros that you may find superior to what is in here.
1515# See Tools/gdb/libpython.py and http://bugs.python.org/issue8032.
1616
17- document pyo
18- Prints a representation of the object to stderr, along with the
19- number of reference counts it currently has and the hex address the
20- object is allocated at. The argument must be a PyObject*
21- end
2217define pyo
2318 # side effect of calling _PyObject_Dump is to dump the object's
2419 # info - assigning just prevents gdb from printing the
2520 # NULL return value
2621 set $_unused_void = _PyObject_Dump($arg0)
2722end
28-
29- document pyg
23+ document pyo
3024 Prints a representation of the object to stderr, along with the
3125 number of reference counts it currently has and the hex address the
32- object is allocated at. The argument must be a PyGC_Head *
26+ object is allocated at. The argument must be a PyObject *
3327end
28+
3429define pyg
3530 print _PyGC_Dump($arg0)
3631end
37-
38- document pylocals
39- Print the local variables of the current frame.
32+ document pyg
33+ Prints a representation of the object to stderr, along with the
34+ number of reference counts it currently has and the hex address the
35+ object is allocated at. The argument must be a PyGC_Head*
4036end
37+
4138define pylocals
4239 set $_i = 0
4340 while $_i < f->f_code->co_nlocals
@@ -50,6 +47,9 @@ define pylocals
5047 set $_i = $_i + 1
5148 end
5249end
50+ document pylocals
51+ Print the local variables of the current frame.
52+ end
5353
5454# A rewrite of the Python interpreter's line number calculator in GDB's
5555# command language
@@ -75,13 +75,13 @@ define lineno
7575 printf "%d", $__li
7676end
7777
78- document pyframev
79- Print the current frame - verbose
80- end
8178define pyframev
8279 pyframe
8380 pylocals
8481end
82+ document pyframev
83+ Print the current frame - verbose
84+ end
8585
8686define pyframe
8787 set $__fn = PyUnicode_AsUTF8(f->f_code->co_filename)
134134# the interpreter you may will have to change the functions you compare with
135135# $pc.
136136
137- document pystack
138- Print the entire Python call stack
139- end
140137define pystack
141138 while $pc < Py_Main || $pc > Py_GetArgcArgv
142139 if $pc > PyEval_EvalFrameEx && $pc < _PyEval_EvalFrameDefault
@@ -146,10 +143,10 @@ define pystack
146143 end
147144 select-frame 0
148145end
149-
150- document pystackv
151- Print the entire Python call stack - verbose mode
146+ document pystack
147+ Print the entire Python call stack
152148end
149+
153150define pystackv
154151 while $pc < Py_Main || $pc > Py_GetArgcArgv
155152 if $pc > PyEval_EvalFrameEx && $pc < _PyEval_EvalFrameDefault
@@ -159,10 +156,10 @@ define pystackv
159156 end
160157 select-frame 0
161158end
162-
163- document pu
164- Generally useful macro to print a Unicode string
159+ document pystackv
160+ Print the entire Python call stack - verbose mode
165161end
162+
166163def pu
167164 set $uni = $arg0
168165 set $i = 0
@@ -174,3 +171,6 @@ def pu
174171 end
175172 end
176173end
174+ document pu
175+ Generally useful macro to print a Unicode string
176+ end
0 commit comments