blob: 05f6a9151c59313e3cd30ce8653f0edc0008ebe1 [file] [log] [blame]
Barry Warsaw39e44d72001-01-23 16:25:19 +00001# -*- ksh -*-
2#
3# If you use the GNU debugger gdb to debug the Python C runtime, you
4# might find some of the following commands useful. Copy this to your
5# ~/.gdbinit file and it'll get loaded into gdb automatically when you
6# start it up. Then, at the gdb prompt you can do things like:
7#
8# (gdb) pyo apyobjectptr
9# <module 'foobar' (built-in)>
10# refcounts: 1
11# address : 84a7a2c
12# $1 = void
13# (gdb)
14
15# Prints a representation of the object to stderr, along with the
16# number of reference counts it current has and the hex address the
17# object is allocated at. The argument must be a PyObject*
18define pyo
Barry Warsawbbd89b62001-01-24 04:18:13 +000019print _PyObject_Dump($arg0)
Barry Warsaw39e44d72001-01-23 16:25:19 +000020end
21
22# Prints a representation of the object to stderr, along with the
23# number of reference counts it current has and the hex address the
24# object is allocated at. The argument must be a PyGC_Head*
25define pyg
Barry Warsawbbd89b62001-01-24 04:18:13 +000026print _PyGC_Dump($arg0)
Barry Warsaw39e44d72001-01-23 16:25:19 +000027end
Jeremy Hyltonf64ec0f2003-10-03 20:56:15 +000028
29# If you are in an eval_frame() function, calling pyframe with no
30# arguments will print the filename, function name, and line number.
31# It assumes that f is the name of the current frame.
32define pyframe
33x/s ((PyStringObject*)f->f_code->co_filename)->ob_sval
34x/s ((PyStringObject*)f->f_code->co_name)->ob_sval
35p f->f_lineno
36end