summaryrefslogtreecommitdiffstats
path: root/Misc/gdbinit
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2001-01-23 16:25:19 (GMT)
committerBarry Warsaw <barry@python.org>2001-01-23 16:25:19 (GMT)
commit39e44d7a9c7fea5e6e8f343082f8f28c4576d5e4 (patch)
tree1a9e940073e145a7619115854ba2a42f963a43fd /Misc/gdbinit
parent9bf16440f4e50efc28212e46d265cf1351cbdcc1 (diff)
downloadcpython-39e44d7a9c7fea5e6e8f343082f8f28c4576d5e4.zip
cpython-39e44d7a9c7fea5e6e8f343082f8f28c4576d5e4.tar.gz
cpython-39e44d7a9c7fea5e6e8f343082f8f28c4576d5e4.tar.bz2
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
pull it in automatically.
Diffstat (limited to 'Misc/gdbinit')
-rw-r--r--Misc/gdbinit27
1 files changed, 27 insertions, 0 deletions
diff --git a/Misc/gdbinit b/Misc/gdbinit
new file mode 100644
index 0000000..a164f42
--- /dev/null
+++ b/Misc/gdbinit
@@ -0,0 +1,27 @@
+# -*- 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
+print PyObject_Dump($arg0)
+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
+print PyGC_Dump($arg0)
+end