how to debug extended module?

Diez B. Roggisch deets at nospam.web.de
Tue Dec 1 04:14:58 EST 2009


junyoung schrieb:
> Hi, I am a newbie who want to implement a extend module to use native
> python language with my own shared library.


If it's a C shared library, don't bother extending it. Use ctypes to 
wrap it. Much easier, and no need for a compiler.

> 
> to test wrapper library(extend module, name is 'test.so'), I created
> some test-cases.
> 
> There are some errors what I couldn't figure our reasons.
> 
> ex)
> SystemError: error return without exception set
> ....
> ...

This indicates that you violated the exception protocol.

http://docs.python.org/c-api/exceptions.html

> so, I ran the ddd with python and then I set test.py as a argument of
> it.
> 
> ex)
> ddd python
> 
> in ddd
> run with arguments : test.py
> 
> 
> but in this situation, I couldn't step in my own shared library
> (compiled as the debug mode).
> 
> Is there any clear way to debug my extend module(that it, debug shared
> library)??

I do it like this:

# gdb python
gdb $ set args test.py
gdb $ run


You can only debug a binary program (test.py isn't one, python is). But 
trough the args, you get yours script running.

It *might* help to have a python debug build, I personally never needed 
that.

Diez



More information about the Python-list mailing list