gdb python C API

derrick derrick at
Tue Jul 19 19:43:58 CEST 2005

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.


More information about the Python-list mailing list