bpo-15817: gdbinit: Document commands after defining them (GH-15021)
The gdb manual[1] says the following for "document": The command commandname must already be defined. [1] https://sourceware.org/gdb/current/onlinedocs/gdb/Define.html And indeed when trying to use the gdbinit file with gdb 8.3, I get: .../cpython/Misc/gdbinit:17: Error in sourced command file: Undefined command: "pyo". Try "help". Fix this by moving all documentation blocks after the define blocks. This was introduced in GH-6384.
This commit is contained in:
parent
aa51508274
commit
1f86fdcfc5
46
Misc/gdbinit
46
Misc/gdbinit
|
@ -14,30 +14,27 @@
|
||||||
# with embedded macros that you may find superior to what is in here.
|
# with embedded macros that you may find superior to what is in here.
|
||||||
# See Tools/gdb/libpython.py and http://bugs.python.org/issue8032.
|
# See Tools/gdb/libpython.py and http://bugs.python.org/issue8032.
|
||||||
|
|
||||||
document pyo
|
|
||||||
Prints a representation of the object to stderr, along with the
|
|
||||||
number of reference counts it currently has and the hex address the
|
|
||||||
object is allocated at. The argument must be a PyObject*
|
|
||||||
end
|
|
||||||
define pyo
|
define pyo
|
||||||
# side effect of calling _PyObject_Dump is to dump the object's
|
# side effect of calling _PyObject_Dump is to dump the object's
|
||||||
# info - assigning just prevents gdb from printing the
|
# info - assigning just prevents gdb from printing the
|
||||||
# NULL return value
|
# NULL return value
|
||||||
set $_unused_void = _PyObject_Dump($arg0)
|
set $_unused_void = _PyObject_Dump($arg0)
|
||||||
end
|
end
|
||||||
|
document pyo
|
||||||
|
Prints a representation of the object to stderr, along with the
|
||||||
|
number of reference counts it currently has and the hex address the
|
||||||
|
object is allocated at. The argument must be a PyObject*
|
||||||
|
end
|
||||||
|
|
||||||
|
define pyg
|
||||||
|
print _PyGC_Dump($arg0)
|
||||||
|
end
|
||||||
document pyg
|
document pyg
|
||||||
Prints a representation of the object to stderr, along with the
|
Prints a representation of the object to stderr, along with the
|
||||||
number of reference counts it currently has and the hex address the
|
number of reference counts it currently has and the hex address the
|
||||||
object is allocated at. The argument must be a PyGC_Head*
|
object is allocated at. The argument must be a PyGC_Head*
|
||||||
end
|
end
|
||||||
define pyg
|
|
||||||
print _PyGC_Dump($arg0)
|
|
||||||
end
|
|
||||||
|
|
||||||
document pylocals
|
|
||||||
Print the local variables of the current frame.
|
|
||||||
end
|
|
||||||
define pylocals
|
define pylocals
|
||||||
set $_i = 0
|
set $_i = 0
|
||||||
while $_i < f->f_code->co_nlocals
|
while $_i < f->f_code->co_nlocals
|
||||||
|
@ -50,6 +47,9 @@ define pylocals
|
||||||
set $_i = $_i + 1
|
set $_i = $_i + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
document pylocals
|
||||||
|
Print the local variables of the current frame.
|
||||||
|
end
|
||||||
|
|
||||||
# A rewrite of the Python interpreter's line number calculator in GDB's
|
# A rewrite of the Python interpreter's line number calculator in GDB's
|
||||||
# command language
|
# command language
|
||||||
|
@ -75,13 +75,13 @@ define lineno
|
||||||
printf "%d", $__li
|
printf "%d", $__li
|
||||||
end
|
end
|
||||||
|
|
||||||
document pyframev
|
|
||||||
Print the current frame - verbose
|
|
||||||
end
|
|
||||||
define pyframev
|
define pyframev
|
||||||
pyframe
|
pyframe
|
||||||
pylocals
|
pylocals
|
||||||
end
|
end
|
||||||
|
document pyframev
|
||||||
|
Print the current frame - verbose
|
||||||
|
end
|
||||||
|
|
||||||
define pyframe
|
define pyframe
|
||||||
set $__fn = PyUnicode_AsUTF8(f->f_code->co_filename)
|
set $__fn = PyUnicode_AsUTF8(f->f_code->co_filename)
|
||||||
|
@ -134,9 +134,6 @@ end
|
||||||
# the interpreter you may will have to change the functions you compare with
|
# the interpreter you may will have to change the functions you compare with
|
||||||
# $pc.
|
# $pc.
|
||||||
|
|
||||||
document pystack
|
|
||||||
Print the entire Python call stack
|
|
||||||
end
|
|
||||||
define pystack
|
define pystack
|
||||||
while $pc < Py_Main || $pc > Py_GetArgcArgv
|
while $pc < Py_Main || $pc > Py_GetArgcArgv
|
||||||
if $pc > PyEval_EvalFrameEx && $pc < _PyEval_EvalFrameDefault
|
if $pc > PyEval_EvalFrameEx && $pc < _PyEval_EvalFrameDefault
|
||||||
|
@ -146,10 +143,10 @@ define pystack
|
||||||
end
|
end
|
||||||
select-frame 0
|
select-frame 0
|
||||||
end
|
end
|
||||||
|
document pystack
|
||||||
document pystackv
|
Print the entire Python call stack
|
||||||
Print the entire Python call stack - verbose mode
|
|
||||||
end
|
end
|
||||||
|
|
||||||
define pystackv
|
define pystackv
|
||||||
while $pc < Py_Main || $pc > Py_GetArgcArgv
|
while $pc < Py_Main || $pc > Py_GetArgcArgv
|
||||||
if $pc > PyEval_EvalFrameEx && $pc < _PyEval_EvalFrameDefault
|
if $pc > PyEval_EvalFrameEx && $pc < _PyEval_EvalFrameDefault
|
||||||
|
@ -159,10 +156,10 @@ define pystackv
|
||||||
end
|
end
|
||||||
select-frame 0
|
select-frame 0
|
||||||
end
|
end
|
||||||
|
document pystackv
|
||||||
document pu
|
Print the entire Python call stack - verbose mode
|
||||||
Generally useful macro to print a Unicode string
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def pu
|
def pu
|
||||||
set $uni = $arg0
|
set $uni = $arg0
|
||||||
set $i = 0
|
set $i = 0
|
||||||
|
@ -174,3 +171,6 @@ def pu
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
document pu
|
||||||
|
Generally useful macro to print a Unicode string
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue