attaching debugger to runinng python program

Bill Pursell bill.pursell at gmail.com
Fri Jul 14 01:02:31 EDT 2006


alf wrote:
> Hi,
>
> I have a two fold question:
> 	-how to attach the debugger to running multi threaded program
> 	-the objective is to find an infinite loop in one of threads which
> makes the whole thingy going craze (100%CPU)
>
> The program itself is not easy, in fact quite hude and sometimes it
> takes hours to get to that infloop state.

On linux:

% python
>>> import os
>>> os.getpid()
54321

Now, in another shell,
% gdb
(gdb) attach 54321

If you want debugging symbols, recompile python with -g.




More information about the Python-list mailing list