attaching debugger to runinng python program

Discussion in 'Python' started by alf, Jul 14, 2006.

  1. alf

    alf Guest

    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
     
    alf, Jul 14, 2006
    #1
    1. Advertising

  2. alf

    Bill Pursell Guest

    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.
     
    Bill Pursell, Jul 14, 2006
    #2
    1. Advertising

  3. alf

    alf Guest

    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.
     
    alf, Jul 14, 2006
    #3
  4. alf

    Guest

    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, 2006
    #4
  5. alf

    Nebur Guest

    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
     
    Nebur, Jul 15, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Kamoski
    Replies:
    1
    Views:
    597
    Jim Cheshire [MSFT]
    Aug 5, 2003
  2. Jim Heavey

    Attaching Debugger

    Jim Heavey, Apr 27, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    327
    Jim Heavey
    Apr 27, 2004
  3. Andy Leszczynski
    Replies:
    1
    Views:
    480
    SPE - Stani's Python Editor
    Dec 13, 2005
  4. Andrew Taranov

    Problem attaching script debugger to ASP under IIS6

    Andrew Taranov, Jun 23, 2005, in forum: ASP General
    Replies:
    2
    Views:
    204
    [MSFT]
    Jun 24, 2005
  5. Dan Bikle
    Replies:
    2
    Views:
    179
    Dan Bikle
    Nov 14, 2005
Loading...

Share This Page