14
14
# with embedded macros that you may find superior to what is in here.
15
15
# See Tools/gdb/libpython.py and http://bugs.python.org/issue8032.
16
16
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
22
17
define pyo
23
18
# side effect of calling _PyObject_Dump is to dump the object's
24
19
# info - assigning just prevents gdb from printing the
25
20
# NULL return value
26
21
set $_unused_void = _PyObject_Dump($arg0)
27
22
end
28
-
29
- document pyg
23
+ document pyo
30
24
Prints a representation of the object to stderr, along with the
31
25
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 *
33
27
end
28
+
34
29
define pyg
35
30
print _PyGC_Dump($arg0)
36
31
end
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*
40
36
end
37
+
41
38
define pylocals
42
39
set $_i = 0
43
40
while $_i < f->f_code->co_nlocals
@@ -50,6 +47,9 @@ define pylocals
50
47
set $_i = $_i + 1
51
48
end
52
49
end
50
+ document pylocals
51
+ Print the local variables of the current frame.
52
+ end
53
53
54
54
# A rewrite of the Python interpreter's line number calculator in GDB's
55
55
# command language
@@ -75,13 +75,13 @@ define lineno
75
75
printf "%d", $__li
76
76
end
77
77
78
- document pyframev
79
- Print the current frame - verbose
80
- end
81
78
define pyframev
82
79
pyframe
83
80
pylocals
84
81
end
82
+ document pyframev
83
+ Print the current frame - verbose
84
+ end
85
85
86
86
define pyframe
87
87
set $__fn = PyUnicode_AsUTF8(f->f_code->co_filename)
134
134
# the interpreter you may will have to change the functions you compare with
135
135
# $pc.
136
136
137
- document pystack
138
- Print the entire Python call stack
139
- end
140
137
define pystack
141
138
while $pc < Py_Main || $pc > Py_GetArgcArgv
142
139
if $pc > PyEval_EvalFrameEx && $pc < _PyEval_EvalFrameDefault
@@ -146,10 +143,10 @@ define pystack
146
143
end
147
144
select-frame 0
148
145
end
149
-
150
- document pystackv
151
- Print the entire Python call stack - verbose mode
146
+ document pystack
147
+ Print the entire Python call stack
152
148
end
149
+
153
150
define pystackv
154
151
while $pc < Py_Main || $pc > Py_GetArgcArgv
155
152
if $pc > PyEval_EvalFrameEx && $pc < _PyEval_EvalFrameDefault
@@ -159,10 +156,10 @@ define pystackv
159
156
end
160
157
select-frame 0
161
158
end
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
165
161
end
162
+
166
163
def pu
167
164
set $uni = $arg0
168
165
set $i = 0
@@ -174,3 +171,6 @@ def pu
174
171
end
175
172
end
176
173
end
174
+ document pu
175
+ Generally useful macro to print a Unicode string
176
+ end
0 commit comments