gpt4 book ai didi

c++ - 无法在Mac OS X上的Visual Code中调试C++

转载 作者:行者123 更新时间:2023-12-02 10:34:48 25 4
gpt4 key购买 nike

我的环境:

$ 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/bin

Visual 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.0
launch.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==1
gdb需要 sudo,因为否则Mac OSX可以使您成为 do some scary code-signing stuff,但可以正常使用。

问题是,当我启动(命中 F5)时,我看到以下内容:
Unable to start debugging. GDB exited unexpectedly with exit code 134 (0x86).

并且调试失败。如何正确设置它以调试VSCode中的C++代码?

最佳答案

您是否曾尝试禁用csrutil? AFAIK,gdb尝试编写一些临时性的东西,就像它在os那样的POSIX中运行一样,但是,默认情况下,macOS限制了根目录只能由应用程序写入,因此它可能无法写入。我有一个类似的问题,我禁用了csrutil,它消失了。您可以尝试相同的方法。

祝好运。

关于c++ - 无法在Mac OS X上的Visual Code中调试C++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60783557/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com