我的环境:
$ clang++ --version
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/binVisual Studio信息:
Version: 1.43.1
Commit: fe22a9645b44368865c0ba92e2fb881ff1afce94
Date: 2020-03-18T07:01:41.240Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 18.7.0launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "MyProject",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/diffusion/run",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"setupCommands": [
{
"text": "-enable-pretty-printing"
}
]
}
]
}我可以很好地运行/编译C++文件。我甚至可以这样运行GDB:
$ sudo gdb diffusion/run
GNU gdb (GDB) 8.3.1
Reading symbols from diffusion/run...
Reading symbols from /Users/me/project/diffusion/run.dSYM/Contents/Resources/DWARF/run...
(gdb) break color
Breakpoint 1 at 0x1000024d6: file diffusion/render.cpp, line 21.
(gdb) condition 1 depth==1gdb需要sudo,否则Mac会让你使用do some scary code-signing stuff,但除此之外一切都很好。
问题是,当我启动(点击F5)时,我看到以下内容:
Unable to start debugging. GDB exited unexpectedly with exit code 134 (0x86).并且调试失败。如何正确设置它以在VSCode中调试C++代码?
发布于 2020-04-07 05:43:42
你有没有试过禁用csrutil?虽然gdb会尝试写一些临时的东西,但默认情况下,macOS会限制应用程序写入根文件夹,所以它可能无法做到这一点。我也遇到过类似的问题,我禁用了csrutil,但它已经消失了。你可以尝试同样的方法。
祝好运。
https://stackoverflow.com/questions/60783557
复制相似问题