Best way of debigging a C extension
miki.tebeka at gmail.com
Thu Dec 11 22:13:35 CET 2008
> I'm writing a C extension. My environment is Python 2.5, with the
> mingw compiler, on Windows XP. At the moment I'm debugging by
> scattering printf() statements around, but it's not always easy. Is
> there a better way of debugging - particularly for diagnosing crashes?
No guaranteed to work ...
* Download WinDbg from http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx#a
* Add "hard" breakpoints in your code using __asm int 3;
* Run your program
If everything works well, when a breakpoint is reached you'll get
message box asking if you want to debug the program.
When you hit "OK", WinDbg should open with your code. Just point it to
the source location and you should be set.
Miki <miki.tebeka at gmail.com>
More information about the Python-list