473,403 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

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 3218
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Chun-Chieh Huang | last post by:
Dear all, I carefully lookup PyObject_Print in the API manual, but I can't find the resolution. And the problem is described below: I embed python into C++ code as follows: // First...
0
by: Brano Zarnovican | last post by:
Hi ! I need to import a module and create an instance of a class from that module (in C). import mod o = mod.klass() (mod.klass is a subclass of tuple)
5
by: David Harris | last post by:
I'm trying the embedded python example here: http://www.python.org/doc/2.3.2/ext/pure-embedding.html int main(int argc, char *argv) { PyObject *pName, *pModule, *pDict, *pFunc; PyObject...
4
by: sjh | last post by:
I'm trying to write an extension for python 2.4, and I can't seem to get PyArg_ParseTuple to work with a dict. I've tried all sorts of things, but the most simple thing that fails is: if...
2
by: ashtonn | last post by:
Hello, How do i print values returned by Py_BuildValue in Linux? PyObject *obj = Py_BuildValue("{s:i}", "Status", status); I need to print the Status value here -Thanks, Ashton
0
by: Skink | last post by:
hi, I'm using boost::python for calling some python code and when the exception is thrown I want to get type, value and traceback of it. The problem is with traceback: I got only *one* frame...
7
by: Christoph Zwerschke | last post by:
The latest Windows distribution of Python 2.4.2 is using the msvcrt71.dll, while PostgreSQL is using msvcrt.dll. This lead to the following problem: I was using PyGreSQL to connect to the...
3
by: Terry Hancock | last post by:
I still run into my own ignorance a lot with unicode in Python. Is it possible to define some combination of __repr__, __str__, and/or __unicode__ so that the unicode() wrapper isn't necessary...
0
by: Riccardo Di Meo | last post by:
Hi everyone, I'm practicing with embedding python into C code and i have encountered a very strange problem: I'm unable to call the "accept" method of a (correctly created) server socket without...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.