rpdb2:如何连接到pid

时间:2012-09-11 09:58:15

标签: python pdb winpdb

我有一个wsgi应用程序在代码中有这个:

import rpdb2; rpdb2.start_embedded_debugger("asdf")

现在使用rpdb2(不是winpdb!)我想连接到进程并开始调试。

我无法弄清楚如何做到这一点。如何连接到正在运行的进程或如何使该进程连接到调试器?

1 个答案:

答案 0 :(得分:8)

使用rpdb2中的命令:

(我假设您要连接到在localhost上运行的进程。否则您应该使用--host开关)

 $ ./rdb2
 RPDB2 - The Remote Python Debugger, version RPDB_2_4_8,
 Copyright (C) 2005-2009 Nir Aides.
 Type "help", "copyright", "license", "credits" for more information.

 > password "debugger"
 Password is set to: "debugger"

 > attach
 Connecting to 'localhost'...
 Scripts to debug on 'localhost':

    pid    name
 --------------------------
    7772   myscript.py

 > attach 7772
 > *** Attaching to debuggee...
 > *** Debug Channel is encrypted.
 > *** Successfully attached to
 > *** 'myscript.py'.
 > *** Debuggee is waiting at break point for further commands.

 > go