Vai*_*den 4 c visual-studio-code vscode-debugger xcode11 macos-catalina
我试图在Mac上使用VSCode开发的C代码上使断点起作用。
我的代码似乎可以编译并运行良好(由于vscode BTW 上没有'openssl / crypto.h'文件),但是我没有得到任何断点,甚至在开始使用"stopAtEntry": true或附加到正在运行的进程时也没有。
我的tasks.json和launch.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"
}
Run Code Online (Sandbox Code Playgroud)
和:
{
"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
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
我知道VS代码会忽略c ++调试中的断点以及此处的所有类似讨论。
我的设置是: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/3829由引起lldb-mi。
lldb-mi是位于IDE和lldb API本身之间的驱动程序。
lldb-mi该插件随附的版本似乎与Catalina不兼容,并且XCode 11.x不再兼容lldb-mi。
github线程提供了2个临时解决方案:
第一种解决方案是lldb-mi通过设置的miDebuggerPath属性,使用XCode早期版本附带的launch.json。
我碰巧有XCode 10.1,所以我的配置是:
"miDebuggerPath":"/Applications/Xcode 10.1.app/Contents/Developer/usr/bin/lldb-mi",
Run Code Online (Sandbox Code Playgroud)
我设法使基本的调试工作,但是存在兼容性问题。但是事实证明这足以满足我的需求(是的!)。
第二种解决方案是使用VSCode-lldb扩展名。
一旦出现,我将保留此答案,并以永久性解决方案更新此帖子。
遵循 @Vaiden 解决方案 2,我在 C++ vscode 调试中继续使用该解决方案。我补充了如何在我的调试配置中使用它。
安装 CodeLLDB vscode 扩展
修改launch.json配置文件
Run Code Online (Sandbox Code Playgroud){ "version": "0.2.0", "configurations": [ { //...other configuration "type": "lldb", // change this one from cppdbg to lldb } ] }
| 归档时间: |
|
| 查看次数: |
949 次 |
| 最近记录: |