【问题标题】:Why is VSCode not stopping at breakpoints for debugging?为什么 VSCode 不在断点处停止调试?
【发布时间】:2021-07-21 02:19:33
【问题描述】:

所以,我知道之前有一篇关于此的帖子:Debugger Not Stopping at Breakpoints in VS Code for Python

但是,我在较新版本的 VSCode 上遇到了完全相同的问题。

我的设置:

  • Manjaro Linux
  • 官方 MS VSCode (1.55.2)
  • 添加了 Python 扩展,并且大部分是默认的(下面是我与 python 相关的 settings.json 设置)
    "[python]": {
        "editor.detectIndentation": true,
        "editor.insertSpaces": true
    },
    "python.autoComplete.addBrackets": true,
    "python.linting.flake8Args": [
        "--ignore=F401,F841,E501,E305,E302"
    ],
    "python.linting.flake8Enabled": true,
    "python.venvPath": "/home/greg/git/code/python/venvs"
    
  • 这是我的 launch.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: Debug Current File",
                "type": "python",
                "request": "launch",
                "program": "${file}",
                "console": "integratedTerminal",
                "stopOnEntry": true,
                "justMyCode": false
            }
        ]
    }
    

【问题讨论】:

  • 有python代码不生成Python VM指令,它们被优化掉了,没有代码有我们无法帮助的工件,反汇编最小的代码有问题
  • 我什至只是放了一个简单的'print("Hello World")',仍然给我同样的问题
  • 请尝试VSCode Insider

标签: python visual-studio-code vscode-settings vscode-debugger


【解决方案1】:

试试:

  1. 从项目中删除launch.json(将其保存在其他地方以备不时之需)
  2. 重启 VS 代码
  3. 尝试调试。如果它提示您输入 launch.json,请使用默认值。

【讨论】:

    猜你喜欢
    • 2016-11-19
    • 2014-04-12
    • 2021-04-16
    • 1970-01-01
    • 1970-01-01
    • 2020-02-08
    • 2019-04-11
    • 2012-02-16
    • 2023-03-12
    相关资源
    最近更新 更多