Debugging Multi-Threaded Python Programs

brueckd at tbye.com brueckd at tbye.com
Wed Aug 15 23:25:53 EDT 2001


On 15 Aug 2001, Alan Green wrote:

> Has anyone out there had luck with interactively debugging
> multi-threaded Python programs? On Windows? Is there an alternative to
> implementing my own GUI debugger (which won't happen)?

Hi Alan,

I had the same problem awhile back with using the profiler with threads -
the current profiler function doesn't get "inherited" from the parent
thread when a child thread is created. I filed a bug on sourceforge and
whoever looked at it set it to an enhancement (meaning, I suppose, that if
it's really important to me then I should get my butt in gear and submit a
two line patch to fix it).

Why don't you submit a patch for the debugging problem and fix my profiler
bug at the same time? ;-)

Anyway, for profiling I got around it by importing the thread module and
replacing its start_thread (or whatever it's called) function with my own
that called the old function and then, in the new thread, set the profiler
function to that of the parent. I seem to remember a few other little
tweaks needed to get it to work but that was the main one. I don't know if
the same thing would work with the debugger, but I thought I'd at least
toss it out as an idea.

-Dave
(if you wait long enough, maybe I'll need to profile a multi-threaded
program again and I'll get around to submitting a patch <g>)





More information about the Python-list mailing list