2001-01-23 12:25:19 -04:00
|
|
|
# -*- ksh -*-
|
|
|
|
#
|
|
|
|
# If you use the GNU debugger gdb to debug the Python C runtime, you
|
|
|
|
# might find some of the following commands useful. Copy this to your
|
|
|
|
# ~/.gdbinit file and it'll get loaded into gdb automatically when you
|
|
|
|
# start it up. Then, at the gdb prompt you can do things like:
|
|
|
|
#
|
|
|
|
# (gdb) pyo apyobjectptr
|
|
|
|
# <module 'foobar' (built-in)>
|
|
|
|
# refcounts: 1
|
|
|
|
# address : 84a7a2c
|
|
|
|
# $1 = void
|
|
|
|
# (gdb)
|
|
|
|
|
|
|
|
# Prints a representation of the object to stderr, along with the
|
|
|
|
# number of reference counts it current has and the hex address the
|
|
|
|
# object is allocated at. The argument must be a PyObject*
|
|
|
|
define pyo
|
2001-01-24 00:18:13 -04:00
|
|
|
print _PyObject_Dump($arg0)
|
2001-01-23 12:25:19 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
# Prints a representation of the object to stderr, along with the
|
|
|
|
# number of reference counts it current has and the hex address the
|
|
|
|
# object is allocated at. The argument must be a PyGC_Head*
|
|
|
|
define pyg
|
2001-01-24 00:18:13 -04:00
|
|
|
print _PyGC_Dump($arg0)
|
2001-01-23 12:25:19 -04:00
|
|
|
end
|
2003-10-03 17:56:15 -03:00
|
|
|
|
|
|
|
# If you are in an eval_frame() function, calling pyframe with no
|
|
|
|
# arguments will print the filename, function name, and line number.
|
|
|
|
# It assumes that f is the name of the current frame.
|
|
|
|
define pyframe
|
|
|
|
x/s ((PyStringObject*)f->f_code->co_filename)->ob_sval
|
|
|
|
x/s ((PyStringObject*)f->f_code->co_name)->ob_sval
|
|
|
|
p f->f_lineno
|
|
|
|
end
|