how to debug extended module?

junyoung juneng603 at gmail.com
Tue Dec 1 19:54:47 EST 2009


On 12월1일, 오후6시14분, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
> 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

here is my results. anyway, check this out.

(gdb) set args connect.py
set args connect.py
(gdb) run
run
Starting program: /usr/bin/python connect.py
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[New Thread 0x7f619747e6e0 (LWP 23683)]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[New Thread 0x415a9950 (LWP 23686)]
[Thread 0x415a9950 (LWP 23686) exited]
[New Thread 0x415a9950 (LWP 23687)]
[Thread 0x415a9950 (LWP 23687) exited]
Traceback (most recent call last):
  File "connect.py", line 25, in <module>
    main()
  File "connect.py", line 18, in main
    connection_test()
  File "connect.py", line 15, in connection_test
    cnxn.close()
SystemError: error return without exception set

Program exited with code 01.
(gdb)

as you see, I can't load symbol table information from gdb.

now python is defaulted installed as release.

my os is ubuntu
the python is installed in /usr/bin
the python version is 2.5.1

do i need to re-install python as debug mode?



More information about the Python-list mailing list