python winpdb远程调试

Posted 在路上

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python winpdb远程调试相关的知识,希望对你有一定的参考价值。

 1.使用rpdb2.start_embedded_debugger ,注意要将参数fAllowRemote 设置为True

    2.winpdb前端GUI使用python2

    3.rpdb兼容python2,3

    4.winpdb-1.4.8下载

 

def start_embedded_debugger(
    pwd,
    fAllowUnencrypted = True,
    fAllowRemote = False,
    timeout = TIMEOUT_FIVE_MINUTES,
    fDebug = False
    ):

    """
    Use \'start_embedded_debugger\' to invoke the debugger engine in embedded
    scripts. put the following line as the first line in your script:

    import rpdb2; rpdb2.start_embedded_debugger(pwd)

    This will cause the script to freeze until a debugger console attaches.

    pwd     - The password that governs security of client/server communication
    fAllowUnencrypted - Allow unencrypted communications. Communication will
                        be authenticated but encrypted only if possible.
    fAllowRemote - Allow debugger consoles from remote machines to connect.
    timeout - Seconds to wait for attachment before giving up. If None,
              never give up. Once the timeout period expires, the debuggee will
              resume execution.
    fDebug  - debug output.

    IMPORTNAT SECURITY NOTE:
    USING A HARDCODED PASSWORD MAY BE UNSECURE SINCE ANYONE WITH READ
    PERMISSION TO THE SCRIPT WILL BE ABLE TO READ THE PASSWORD AND CONNECT TO
    THE DEBUGGER AND DO WHATEVER THEY WISH VIA THE \'EXEC\' DEBUGGER COMMAND.

    It is safer to use: start_embedded_debugger_interactive_password()
    """

    return __start_embedded_debugger(
                        pwd,
                        fAllowUnencrypted,
                        fAllowRemote,
                        timeout,
                        fDebug
                        )

def start_embedded_debugger_interactive_password(
    fAllowUnencrypted = True,
    fAllowRemote = False,
    timeout = TIMEOUT_FIVE_MINUTES,
    fDebug = False,
    stdin = sys.stdin,
    stdout = sys.stdout
    ):

    if g_server is not None:
        return

    if stdout is not None:
        stdout.write(\'Please type password:\')

    pwd = stdin.readline().rstrip(\'n\')

    return __start_embedded_debugger(
                        pwd,
                        fAllowUnencrypted,
                        fAllowRemote,
                        timeout,
                        fDebug
                        )

 

参考:

  1.https://segmentfault.com/a/1190000000356018

  2.http://winpdb.org/docs/embedded-debugging/

以上是关于python winpdb远程调试的主要内容,如果未能解决你的问题,请参考以下文章

winpdb 不适用于 python 3.3

如何从本地窗口与代码调试远程 python 代码

一文掌握vscode远程调试python代码

一文掌握vscode远程调试python代码

如何使用 PyCharm 在远程机器上调试从 Python 调用的 C++ 代码?

如何使用 VS Code 在 Docker 容器中远程调试 python 代码