Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 39e44d7

Browse files
committed
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
pull it in automatically.
1 parent 9bf1644 commit 39e44d7

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Misc/gdbinit

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# -*- 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*
18+
define pyo
19+
print PyObject_Dump($arg0)
20+
end
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*
25+
define pyg
26+
print PyGC_Dump($arg0)
27+
end

0 commit comments

Comments
 (0)