Best way of debigging a C extension

Miki miki.tebeka at gmail.com
Thu Dec 11 16:13:35 EST 2008


Hello Paul,

> 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.

HTH,
--
Miki <miki.tebeka at gmail.com>
http://pythonwise.blogspot.com



More information about the Python-list mailing list