Debugging a Python Extension in Eclipse

I have a Python extension that I have successfully built and used on Windows, OSX, and linux. I now need to be able to debug this Python extension. I am averse to the use of gdb at the command line, so I would really like to get this to work in Eclipse.

To begin with, I did my best to follow the instructions in http://www.heikkitoivonen.net/blog/2008/07/21/debugging-python-extension-written-in-c-with-eclipse/, and I added the folder for the Python source as well as the folder for the python extension code as source folders to the empty project. Since it is relatively easy to get debug builds of everything required on linux, I started out with the debug development in Ubuntu.

Once I got a debug build of python (lets call it python_d), I ran the setup.py for my extension with

python_d setup.py build

which should also yield a debug build of the extension module. I have verified that symbols are being exported by opening the extension as an application in Eclipse and I can see the source code linked with the Python shared object.

Now if I create another project in Eclipse with the folder of my code, and add a breakpoint in the source that is used to create the extension, it doesn't stop at the breakpoint. It is entirely possible that I am missing something rather critical here, but for the life of me I can't get it to work. The crux of the problem is:

How can you get Eclipse to stop at a breakpoint in a Python extension module?

34
задан Ian Bell 31 May 2011 в 05:20
поделиться