【问题标题】:VSCode debugger auto attach to subprocessVSCode 调试器自动附加到子进程
【发布时间】:2018-10-15 20:54:51
【问题描述】:

在下面的控制台输出中,它清楚地表明断点在新进程中不起作用。用于附加到子进程的调试器设置在哪里?

pydev debugger: starting

pydev debugger: New process is launching (breakpoints won't work in the new process).
pydev debugger: To debug that process please enable 'Attach to subprocess automatically while debugging?' option in the debugger settings.

Bottle v0.12.13 server starting up (using WSGIRefServer())...
Listening on http://0.0.0.0:8080/
Hit Ctrl-C to quit.

【问题讨论】:

    标签: python visual-studio-code pydev bottle


    【解决方案1】:

    是的。截至 2018 年底,VSCode 可以调试 python 子进程。我们只需要正确设置配置。在 Visual Studio Code 中,编辑 launch.json 文件并将 "subProcess": true 键值对添加到您正在使用的调试配置中。这是一个例子。

    "configurations": [
       {
           "name": "Python: Current File",
           "type": "python",
           "request": "launch",
           "subProcess": true,
           "program": "${file}",
           "console": "integratedTerminal"
       }
    

    ]

    【讨论】:

    • 我有"subProcess": false。但我仍然能够调试到 supProcess 模块。有什么想法吗?
    【解决方案2】:

    我不知道如何附加到子流程。 但是,我在调试 python 烧瓶时遇到了同样的问题,我注意到pydev debugger: New process is launching ... 问题与我在 app.run 中使用use_reloader=True 相关。当我删除它时,断点工作正常!

    【讨论】:

    • 我确实在底部的状态栏上看到了一个可切换的Auto Attach: Off 选项。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-08-25
    • 2018-09-23
    • 2021-12-02
    • 2011-04-18
    • 2023-03-07
    • 2017-09-13
    • 1970-01-01
    相关资源
    最近更新 更多