By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,548 Members | 1,513 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,548 IT Pros & Developers. It's quick & easy.

attaching debugger to runinng python program

P: n/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
Jul 14 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a

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.

Jul 14 '06 #2

P: n/a
alf
Bill Pursell wrote:
Now, in another shell,
% gdb
(gdb) attach 54321
Thx for the reply. But I wish to debug the python program, not python
interpreter itself.
Jul 14 '06 #3

P: n/a

alf wrote:
Bill Pursell wrote:
Now, in another shell,
% gdb
(gdb) attach 54321

Thx for the reply. But I wish to debug the python program, not python
interpreter itself.
I haven't used this, but it looks like it's worth a try:

http://hapdebugger.sourceforge.net/

Jul 14 '06 #4

P: n/a
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

Jul 15 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.