c - VSCode、MacOS Catalina - 不会在 C/C++ 调试的断点处停止

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

我正在尝试让断点适用于在 Mac 上使用 VSCode 开发的 C 代码。

我的代码似乎编译和运行得很好(感谢 'openssl/crypto.h' file not found on vscode B.T.W)但我没有得到任何断点,甚至在开始使用 "stopAtEntry": true 或附加到一个正在运行的进程。

我的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。

有没有人比我运气好?

最佳答案

显然这是 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与以前版本的 XCode 捆绑在一起,通过设置 miDebuggerPath launch.json的属性(property).

我碰巧有 XCode 10.1,所以我的配置是:

"miDebuggerPath":"/Applications/Xcode 10.1.app/Contents/Developer/usr/bin/lldb-mi",

我设法进行了基本的调试,但有 compatibility issues to be expected .然而,事实证明这足以满足我的需求(耶!)。

替代的 lldb 前端

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

更新在这里

我会保留这个答案和这个 post一旦出现就更新为永久解决方案。

关于c - VSCode、MacOS Catalina - 不会在 C/C++ 调试的断点处停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58329611/

相关文章:

mono - OSX - 错误 : Cannot start Omnisharp because Mono version >=4. 需要 0.1

visual-studio-code - 如何在 VS CODE 中使用 CoreCLR 调试控制台应用程序?

visual-studio-code - 在 Visual Studio Code 中找不到自动修复保存按钮

ios - Xcode 11,使用 iOS 10.3.3 设备,设备和模拟器对话框中没有 "Connect via Network"

swift - 如何使用 swiftUI View 在启动时将 Google map 相机聚焦在用户当前位置

c - 如何在 lua 脚本中检索堆栈中的值?

c - 如何在c中使用mmap

c - 使用 (void *) 1 而不是 null 作为占位符是否有优势

c - glOrtho(-1, 1, -1, 1, -1, 1) 完成了什么?

xcode - 如何在 iOS Xcode Swift Playground 上模拟黑暗模式