Best way of debigging a C extension

Diez B. Roggisch deets at nospam.web.de
Fri Dec 12 00:55:30 CET 2008


Christian Heimes schrieb:
> Diez B. Roggisch schrieb:
>> I never tried this on windows - but what happens if you start python
>> inside GDB, and then set breakpoints inside your extension?
>>
>> This works flawlessly for me under *nix.
>>
>> The debug-build of python isn't needed for this - and I doubt a bit that
>> it helps you much, as being inside the interpreter & getting detailed
>> information isn't your goal - you want to see your extensions functions,
>> what parameters they get and so on.
> 
> It doesn't work well with all debugging symbols stripped and with -O2
> optimized code. The compiler rearranges the code. You could try to
> compile your own code with different compiler arguments. I don't know if
>  that's easily possible on Windows with Python 2.5.

As I said - as long as you don't care about the python debug code 
itself, it works pretty well. Usually, the problems are within your 
extension, which you have the full control over regarding symbols & 
optimization settings.

Diez



More information about the Python-list mailing list