c++ - 错误:无法开始调试。来自命令“-exec-run”的意外 GDB 输出。找不到进程 ID 1401 的 Mach 任务端口
问题描述
我正在尝试使用 GDB 在 C++ 项目中的 VSCode 中运行调试器,但在运行调试器时我不断收到此错误。我已经设置了证书和所有内容,但它仍然给我这个错误(我正在运行 macOS Catalina 版本 10.15.4)。
这是我的 launch.json 文件
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/Assignment8",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
这是我的 tasks.json 文件
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "echo",
"type": "shell",
"command": "make",
"options": {
"cwd": "${workspaceFolder}/build"
},
}
]
}
此外,我看到了一些关于制作 .gdbinit 文件的内容,我在我的根目录中完成了该文件,并在其中放置了以下命令:
set startup-with-shell off
对此问题的任何帮助将不胜感激。
解决方案
我也有同样的问题。或多或少是这样的:
错误:无法开始调试。来自命令“-exec-run”的意外 GDB 输出。创建进程 /usr/bin/ 时出错,(错误 2)。
要修复,请尝试使用较低版本的 gcc / g++(v_9 左右),特别是较低版本的 gdb(v_10,安装的实验版本是问题,更改为 9.3 并确定)。
推荐阅读
- python - SWIG 中的垃圾收集和自定义 getter
- excel - Excel VBA -IE 保存下载文件并再次打开
- python-3.x - filedialog 不显示顶部的窗口
- laravel - 如何修复“GET css/app.css net::ERR_ABORTED 404(未找到)”?
- xamarin - 未找到 JetBrains Rider 的 Xamarin SDK
- android - 我无法在未解决的参考中找出错误
- razor - 如何用foreach编写复选框?
- regex - 用正则表达式替换进行它的单词
- python - MySQL游标使用最后一个游标更新所有列
- android - 为什么 contentResolver.query() 返回 null?