VSCode,MacOS Catalina-在C / C ++调试时不会在断点处停止

时间:2019-10-10 19:07:39

标签: c visual-studio-code xcode11 vscode-debugger macos-catalina

我正在尝试使断点在Mac上使用VSCode开发的C代码上工作。

我的代码似乎可以编译并正常运行(感谢'openssl/crypto.h' file not found on vscode,但是我没有得到任何断点,甚至在开始使用"stopAtEntry": true或附加到正在运行的进程时也没有。) / p>

我的tasks.jsonlaunch.json非常标准:

{
    "tasks": [
        {
            "type": "shell",
            "label": "clang build active file",
            "command": "/usr/bin/clang",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}",
                "-I/usr/local/opt/openssl/include",
                "-L/usr/local/opt/openssl/lib",
                "-lssl",
                "-lcrypto"
            ],
            "options": {
               "cwd": "/usr/bin"
            }
        }
    ],
    "version": "2.0.0"
}

并且:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(lldb) Attach",
            "type": "cppdbg",
            "request": "attach",
            "program": "${workspaceFolder}/test2",
            "processId": "${command:pickProcess}",
            "MIMode": "lldb"
        },
        {
            "name": "clang build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "lldb",
            "preLaunchTask": "clang build active file",
            "logging": {
                "trace": false,
                "traceResponse": false,
                "engineLogging": false
              }
        }
    ]
}

我知道VS code is ignoring the breakpoint in c++ debugging和此处所有类似的讨论。

我的设置是: MacOS Catalina(10.15,生产中)以及XCode 11.1,Visual Studio Code 1.39.0和C / C ++扩展0.26.0-insiders3。

有人比我好运吗?

1 个答案:

答案 0 :(得分:6)

显然,这是Catalina和XCode 11.x支持的一个已知问题:https://github.com/microsoft/vscode-cpptools/issues/3829lldb-mi引起。

lldb-misits between the IDE and the lldb API itself的驱动程序。

该插件随附的lldb-mi版本似乎与Catalina不兼容,并且XCode 11.x不再具有lldb-mi

github线程提供了2个临时解决方案:

lldb-mi

第一种解决方案是通过设置lldb-mi的{​​{1}}属性来使用XCode早期版本附带的miDebuggerPath

我刚好有XCode 10.1,所以我的配置是:

launch.json

我设法使基本调试起作用,但是有compatibility issues to be expected。但是事实证明,这足以满足我的需求(是!)。

替代lldb前端

第二种解决方法是使用VSCode-lldb extension

更新来了

我将保留此答案,并在提出此post之后以永久性解决方案对其进行更新。