attaching debugger to runinng python program

A

alf

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.

Any insight?

Andy
 
B

Bill Pursell

alf said:
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:

% python54321

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

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

Nebur

You may try winpdb.
I find it to be a comfortable debugger that also can attach to running
programs. (You need to add a line in your code where the program should
stop and wait for the debugger to attach.)
I am satisfied with it, but I did not debug a multi theaded app.
However, it can handle threads. I'd be glad to later hear whether it
did what you need, or not:

http://www.digitalpeers.com/pythondebugger/threads.htm

Regards, Ruben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top