469,284 Members | 2,519 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,284 developers. It's quick & easy.

PyObject_Print in gdb

I've been using gdb to debug some Python extension modules lately,
which has been very handy, but cannot get PyObject_Print() to work
from within gdb, as recommended by http://wingware.com/doc/howtos/debug...dules-on-linux

It recommends using "p PyObject_Print (obj, stderr, 0)" but stderr
(and stdout) symbols are never available for me.

(gdb) p args
$2 = (PyObject *) 0x405030
(gdb) p PyObject_Print (args, stderr, 0)
No symbol "stderr" in current context.
(gdb) p PyObject_Print (args, stdout, 0)
No symbol "stdout" in current context.

Any tips on how to reference the stdout/stderr file pointers within
gdb?

Cheers,
Chris

May 15 '07 #1
1 3003
I'm still not sure about PyObject_Print, but I found a better
solution, using the Misc/gdbinit file from the Python source tree,
which defines a pyo macro.

Example:
(gdb) pyo some_object
object : []
type : list
refcount: 1
address : 0x4b5940
$3 = void

Cheers,
Chris
On May 15, 2:15 pm, Chris Miles <miles.ch...@gmail.comwrote:
I've been using gdb to debug some Python extension modules lately,
which has been very handy, but cannot get PyObject_Print() to work
from within gdb, as recommended byhttp://wingware.com/doc/howtos/debugging-extension-modules-on-linux

It recommends using "p PyObject_Print (obj, stderr, 0)" but stderr
(and stdout) symbols are never available for me.
May 15 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Chun-Chieh Huang | last post: by
reply views Thread by Brano Zarnovican | last post: by
4 posts views Thread by sjh | last post: by
2 posts views Thread by ashtonn | last post: by
reply views Thread by Skink | last post: by
7 posts views Thread by Christoph Zwerschke | last post: by
3 posts views Thread by Terry Hancock | last post: by
reply views Thread by Riccardo Di Meo | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.