- 操作系统及版本:Windows 10 Build 19042.985
- VS Code 版本号:1.56.2
- C/C++ 扩展程序版本号:v1.4.0-insiders
- 其他扩展程序:remote-ssh
我一直在使用 Raspberry 上的 remote-ssh 和 C/C++ 扩展程序,但突然之间无法启动调试器。什么都没有改变,配置文件与以前相同,但现在当我启动调试器时,只看到顶部调试栏短暂出现了几秒钟,然后就消失了。控制台上没有任何消息。
为此,我从头开始创建了一个简单的项目,但是遇到了同样的问题。
复现步骤 launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"logging": { "engineLogging": true },
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": false
}
]
}
]
}
main.c
#include <stdio.h>
int main(){
printf("ciao\n");
return 1;
}
使用 gcc -g main.c
进行编译。
如我之前所述,这个工作流程曾经对我有用,但在一秒钟内它停止了按预期工作,我不知道为什么以及如何修复,任何帮助都将不胜感激。
我尝试过的
- 重新安装 vscode
- 重新安装 c/c++ 扩展并手动删除扩展文件夹
- 多次重启
更新
我已经尝试使用 wsl-remote 扩展,并且它按预期工作。
尝试卸载主机上的 gdb 并启动调试会话,但“gdb未找到”的消息甚至没有出现,如应该出现的那样。
"stopAtEntry": true,
。 - Omni