gdb python C API

D

derrick

I have written a c program to interface with a newly installed version
of python 2.4.1 on my system. The C program calls a module written in
python that goes on to parse an xml file and do other xml specific
operations. When I use the module in python, it seems to work alright,
but when I try to use my c program to interface, sometimes it works and
sometimes it segfaults. I tried using gdb find the segfault, but in the
C program, once the python module is called, gdb tells me that some
python compiled code has been placed on the stack and is being executed,
but i am having trouble finding what part of the python module is being
executed (which makes it hard to find the real reason for the segfault).

are there any tools / methods that others have used to get what line of
the python script is being executed while running in gdb? or if it would
actually show me the source python script (instead of the the python c
source) that would help.

my setup is:
self compiled/installed python 2.4.1
my python module calls the xml.dom.minidom module.

my problem might be refcounts, i've looked over them many times and they
seem to make sense to me but it never hurts to have someone else's opinion.

tia,
derrick
 
F

fraca7

derrick a écrit :
are there any tools / methods that others have used to get what line of
the python script is being executed while running in gdb? or if it would
actually show me the source python script (instead of the the python c
source) that would help.

I don't think so, but when having a memory problem I usually find
valgrind very useful.

http://valgrind.org/

HTH
 
S

skip

fraca7> derrick a écrit :
fraca7> I don't think so, but when having a memory problem I usually
fraca7> find valgrind very useful.

Actually, take a look in the distribution at Misc/gdbinit. In particular,
check out the pystack command.

Skip
 
F

fraca7

(e-mail address removed) a écrit :
Actually, take a look in the distribution at Misc/gdbinit. In particular,
check out the pystack command.

Wow, nice! This will be put to good use, thanks :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,209
Messages
2,571,088
Members
47,684
Latest member
sparada

Latest Threads

Top