[Tutor] Debugging multithreaded programs in python

Kent Johnson kent37 at tds.net
Tue Aug 1 12:19:22 CEST 2006

Noufal Ibrahim wrote:
> Greetings all,
>     A friend here is trying to debug a rather badly written python program
> which spawns off lots of threads here and there.  Are there any
> frameworks that I can reccommend that would ease his pain?
winpdb claims to debug multi-threaded programs. I have found it useful 
for single-threaded programs, haven't tried it for m-t.

Debugging m-t programs can be very hard. Placing a breakpoint can change 
the timing so a bug doesn't appear, or ruin a critical response time. 
Print statements can help.

You say the program is badly written, if it uses more threads than 
needed maybe the first step is to get rid of some of them. You could 
also look for subsystems that could be tested independently, perhaps 
using unittest.


More information about the Tutor mailing list