debugging program that uses ctypes

M

marco_347

hi all, I have a python program that calls a dll through ctypes
(py2.5). In some (reproducible)
conditions the program crashes with an error in ctypes module.
How can I trace down the problem? I have created a debug build of
python but I also use pyodbc
and dateutil libraries in my program and I don't know how to make them
visible to python_d.exe
Am I using the right approach?

thanks in advance for hints,
Marco
 
T

Thomas Heller

hi all, I have a python program that calls a dll through ctypes
(py2.5). In some (reproducible)
conditions the program crashes with an error in ctypes module.

You mean a segfault?
How can I trace down the problem? I have created a debug build of
python but I also use pyodbc
and dateutil libraries in my program and I don't know how to make them
visible to python_d.exe
Am I using the right approach?

I would say yes. It seems you are using windows - running debug builds of
python on windows start a dialog box that allows to attach the MSVC debugger
to the running program. Usually this allows to locate the error fairly quickly.

As you have discovered, the problem is that you need to build all the extensions
that you use in debug mode otherwise you cannot use them.

If you cannot rebuild the extensions you have to reproduce the crash in
a script that doesn't use these extensions.

Thomas
 
M

Miki

Hello Marco,
hi all, I have a python program that calls a dll through ctypes
(py2.5). In some (reproducible)
conditions the program crashes with an error in ctypes module.
How can I trace down the problem? I have created a debug build of
python but I also use pyodbc
and dateutil libraries in my program and I don't know how to make them
visible to python_d.exe
Am I using the right approach?
If you are the one compiling the called module, you can add `__asm int
3` somewhere in
the code. When this is reached, the windows debugger will pop up on
the line.

HTH,
 

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
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top