VSCode,MacOS Catalina-在C/C ++调试时不会在断点处停止 [英] VSCode, MacOS Catalina - doesn't stop on breakpoints on C/C++ debug

查看:581
本文介绍了VSCode,MacOS Catalina-在C/C ++调试时不会在断点处停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to make breakpoints work on C code developed using VSCode on Mac.

我的代码似乎可以编译并正常运行(感谢或附加到正在运行的进程时也没有.

My code seems to compile and run just fine (thanks to 'openssl/crypto.h' file not found on vscode B.T.W) but I don't get any breakpoints, not even on start using "stopAtEntry": true or by attaching to a running process.

我的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代码正在忽略断点在c ++调试中以及此处所有类似的讨论.

I'm aware of VS code is ignoring the breakpoint in c++ debugging and all of the similar discussions here.

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

My setup is: MacOS Catalina (10.15, production) alongside XCode 11.1, Visual Studio Code 1.39.0 and C/C++ extension 0.26.0-insiders3.

有人比我好运吗?

推荐答案

显然,这是Catalina和XCode 11.x支持的一个已知问题:

So apparently it's a known issue with Catalina and XCode 11.x support: https://github.com/microsoft/vscode-cpptools/issues/3829 caused by lldb-mi.

lldb-mi位于IDE和lldb API本身.

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

It appears that the version of lldb-mi that comes bundled with the plugin isn't compatible with Catalina, and XCode 11.x doesn't have lldb-mi anymore.

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

The github thread offers 2 temporary solutions:

第一个解决方案是通过设置launch.jsonmiDebuggerPath属性来使用XCode早期版本附带的lldb-mi.

The first solution is to use the lldb-mi that comes bundled with previous versions of XCode, by setting the miDebuggerPath property of launch.json.

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

I happened to have XCode 10.1 laying around so my configuration is:

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

我设法使基本的调试工作正常进行,但是仍然存在兼容性问题预期.但是事实证明,这足以满足我的需求(是的!).

I managed to get basic debugging working but there are compatibility issues to be expected. However this turned out to be good enough for my needs (yay!).

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

The second solution is to use the VSCode-lldb extension.

我将保留此答案以及帖子更新后,将使用永久解决方案进行更新.

I will keep this answer and this post updated with a permanent solution once it comes up.

这篇关于VSCode,MacOS Catalina-在C/C ++调试时不会在断点处停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆