我已经在Linux(Centos 7)上使用VS Code 6个月以上,并且使用VS Code调试我的C ++代码没有问题。大约一周前,我更新到了最新版本(1.29.0)。从那时起,我再也无法使用已经使用了一段时间的相同launch.json配置设置来启动gdb会话。我一直无法弄清楚为什么。甚至使用“没有调试就启动”从“调试”菜单启动,也不会再启动我的测试应用程序(当我通过“调试”菜单选择“启动调试”时也不会启动gdb)。
我的launch.json文件非常简单/基本(如下)。我的二进制文件被写入环境变量($ PROJHOME)标识的位置,或通过未定义$ PROJHOME但$ HOME的那些计算机上的硬编码路径写入。
任何建议都将不胜感激,因为这使我发疯。
{
// 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": "${env:PROJHOME}/bin/test",
"args": [],
"stopAtEntry": false,
"cwd": "${env:PROJHOME}/bin",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${env:HOME}/projects/bin/test",
"args": [],
"stopAtEntry": false,
"cwd": "${env:HOME}/projects/bin",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}