[IPython-user] Debugging with IPython.

Fernando Perez Fernando.Perez at colorado.edu
Thu Apr 14 20:08:09 CDT 2005

Andrea Riciputi wrote:
> Hi all,
> I'm try to debug and trace some Python-wrapped C code and in particular 
> I'm mainly interested to check for memory leaks.
> What I have is a bunch of C function accepting multi-dimensional arrays 
> as input parameters and returning other arrays. These functions have 
> been wrapped into a Python module, and I'd like to check whether the 
> module behaves correctly from with Python. In particular I'm interested 
> in checking if all the data structure are de-allocated correctly when 
> they come out of scope.
> May I do these kind of things using pdb from within IPython? How?

Not that I know.  As far as I know, all C extension code is a black box to 
pdb.  In order to get internal info from your extension modules, you'll need 
to resort to traditional gdb tactics, and I think that to really get very far 
you need to work with a debug build of python.

But I actually know very little about debugging extension modules (I never 
make mistakes when I code in C/C++ :), see Andrew Straw's message from a few 
weeks back, which had some info about this (in the context of threads 
debugging, but much of it could apply here).



ps. Andrew's email might have been on the -dev list, I don't quite remember; 
check both.

More information about the IPython-user mailing list