0

我正在使用 VSCode 和 Python 扩展在 Python 中的多线程项目中工作。一切正常,直到突然,我没有更改任何设置)它停止显示调用堆栈中正在运行的进程和线程。调用堆栈现在是空的,直到它在断点处停止。

这仅适用于 Python。例如,对于 C++,它可以工作,如下图所示:

c++调用栈; 显示正在运行的线程

这里遵循我的配置文件:

设置.json:

{
    "python.pythonPath": "C:\\Users\\tiago\\AppData\\Local\\Programs\\Python\\Python38\\python.exe",
    "python.linting.pylintEnabled": false,
    "python.linting.enabled": true,
    "python.linting.pylamaEnabled": false,
    "python.linting.flake8Enabled": true
}

启动.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "externalTerminal"
        }
    ]
}
4

1 回答 1

0

发生这种情况是因为我将“ GEVENT_SUPPORT ”环境变量设置为True正如@fabioz 所说,“在 gevent 模式下,调试器希望线程模块由 gevent 进行猴子修补,因此它不会跟踪那些(如在 gevent 模式下,您只需要 1 个主线程)。”

于 2020-10-09T16:20:39.927 回答