Skip to content

Commit 7286dbd

Browse files
smontanaroned-deily
authored andcommitted
bpo-15817: Expose command documentation to gdb help (GH-6384)
Original patch by Alexander Belopolsky. Patch by Skip Montanaro.
1 parent 091e95e commit 7286dbd

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

Misc/gdbinit

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,30 @@
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-
# Prints a representation of the object to stderr, along with the
18-
# number of reference counts it current has and the hex address the
19-
# object is allocated at. The argument must be a PyObject*
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
2022
define pyo
2123
# side effect of calling _PyObject_Dump is to dump the object's
2224
# info - assigning just prevents gdb from printing the
2325
# NULL return value
2426
set $_unused_void = _PyObject_Dump($arg0)
2527
end
2628

27-
# Prints a representation of the object to stderr, along with the
28-
# number of reference counts it current has and the hex address the
29-
# object is allocated at. The argument must be a PyGC_Head*
29+
document pyg
30+
Prints a representation of the object to stderr, along with the
31+
number of reference counts it currently has and the hex address the
32+
object is allocated at. The argument must be a PyGC_Head*
33+
end
3034
define pyg
3135
print _PyGC_Dump($arg0)
3236
end
3337

34-
# print the local variables of the current frame
38+
document pylocals
39+
Print the local variables of the current frame.
40+
end
3541
define pylocals
3642
set $_i = 0
3743
while $_i < f->f_code->co_nlocals
@@ -69,7 +75,9 @@ define lineno
6975
printf "%d", $__li
7076
end
7177

72-
# print the current frame - verbose
78+
document pyframev
79+
Print the current frame - verbose
80+
end
7381
define pyframev
7482
pyframe
7583
pylocals
@@ -126,7 +134,9 @@ end
126134
# the interpreter you may will have to change the functions you compare with
127135
# $pc.
128136

129-
# print the entire Python call stack
137+
document pystack
138+
Print the entire Python call stack
139+
end
130140
define pystack
131141
while $pc < Py_Main || $pc > Py_GetArgcArgv
132142
if $pc > PyEval_EvalFrameEx && $pc < PyEval_EvalCodeEx
@@ -137,7 +147,9 @@ define pystack
137147
select-frame 0
138148
end
139149

140-
# print the entire Python call stack - verbose mode
150+
document pystackv
151+
Print the entire Python call stack - verbose mode
152+
end
141153
define pystackv
142154
while $pc < Py_Main || $pc > Py_GetArgcArgv
143155
if $pc > PyEval_EvalFrameEx && $pc < PyEval_EvalCodeEx
@@ -148,7 +160,9 @@ define pystackv
148160
select-frame 0
149161
end
150162

151-
# generally useful macro to print a Unicode string
163+
document pu
164+
Generally useful macro to print a Unicode string
165+
end
152166
def pu
153167
set $uni = $arg0
154168
set $i = 0

0 commit comments

Comments
 (0)