[PyKDE] sip: debugging techniques

Patrick Stinson ajole-1 at gci.net
Mon Sep 22 07:28:00 BST 2003


This is a question regarding debugging applications running C code wrapped in 
sip-generated python bindings. The problem is posed by the devision of python 
code and C symbols loaded as modules. When a segmentation fault occurs in the 
C code, usually the only life boat at one's disposal is an interpreter 
traceback, or a WAD[1] generated code dump.

A programmer may write a fairly sophisticated library in C, test it, and find 
even the simplest of methods to work differently after they've been wrapped 
in python. For example, virtual methods may have different behavior, argument 
types may be cast differently (not so often though), and some problems may 
rise with no explainable cause or solution (even thoough you may have fixed 
it!).

So, my larger assertion is this: tracing the origin of problematic code is 
tedious, because next to WAD-generated call stacks, coders can only debug C 
code in python with CODE101-style print statements. Has anyone found any 
other techniques or coding styles to make crossing the symatic boundary 
easier? Has anyone attempted a sort of socket-enabled debugging system? 

I see visions of kdevelop3/eric3 plugins for [C,C++]/python traversal...

Thanks!
-Patrick
http://br.logorrhea.com/

[1] WAD is a terrific tool for printing core dumps, and reporting C++ 
exceptions in python. better yet, it prints the call stack when an uncaught 
segmentation fault occurs. It can be found here:
http://systems.cs.uchicago.edu/Papers/python9/python.html




More information about the PyQt mailing list