How to use Py_DEBUG ?

MCG mathieu.courtois at gmail.com
Wed Nov 26 15:40:32 CET 2008


Hello,

Does somebody know how to debug this kind of bug ? (see following
traceback)
I suppose that the bug is in my program (executable with python
embedded) and not in python... but how to locate it ?
I tried to compile all C sources calling Python.h with -DPy_DEBUG and
to link my code against config_d/libpython2.5.a, but I get no more
information.
Is it the right way ?

Can gc module get interesting information ?


#0  0x093179a9 in visit_decref (op=0x302e3020, data=0x0) at ../Modules/
gcmodule.c:270
#1  0x0928c4c1 in dict_traverse (op=0xa315214, visit=0x9317976
<visit_decref>,
    arg=0x0) at ../Objects/dictobject.c:1892
#2  0x09317a74 in subtract_refs (containers=0x96802c8) at ../Modules/
gcmodule.c:295
#3  0x09318746 in collect (generation=2) at ../Modules/gcmodule.c:790
#4  0x09319245 in PyGC_Collect () at ../Modules/gcmodule.c:1265
#5  0x0930857a in Py_Finalize () at ../Python/pythonrun.c:389
#6  0x0930b5ef in Py_Exit (sts=0) at ../Python/pythonrun.c:1618
#7  0x09309caf in handle_system_exit () at ../Python/pythonrun.c:1054
#8  0x09309ccd in PyErr_PrintEx (set_sys_last_vars=1) at ../Python/
pythonrun.c:1064
#9  0x093099df in PyErr_Print () at ../Python/pythonrun.c:978
#10 0x0930944e in PyRun_SimpleFileExFlags (fp=0x9ce6900,
    filename=0xbf840644 "Python/Execution/E_SUPERV.py", closeit=1,
flags=0xbf83fbb0)
    at ../Python/pythonrun.c:883
#11 0x09308b7c in PyRun_AnyFileExFlags (fp=0x9ce6900,
    filename=0xbf840644 "Python/Execution/E_SUPERV.py", closeit=1,
flags=0xbf83fbb0)
    at ../Python/pythonrun.c:698
#12 0x09317648 in Py_Main (argc=23, argv=0xbf83fcc4) at ../Modules/
main.c:523
#13 0x0809eaa9 in main (argc=23, argv=0xbf83fcc4)

Thanks,
MC



More information about the Python-list mailing list