我想在 vscode 中启动 gdb。我想在 vscode 中使用 gdb 调试我的 c 代码,但出现以下错误:
无法从命令环境 cd 开始调试意外的 gdb 输出 我在 wsl 上安装了我的 gdb。
这是我的 lauch.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}\\bin\\main",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"pipeTransport": {
"pipeCwd": "",
"pipeProgram": "c:\\windows\\sysnative\\bash.exe",
"pipeArgs": ["-c"],
"debuggerPath": "/usr/bin/gdb"
},
"sourceFileMap": {
"/mnt/z": "z:\\"
}
}
]
我无法调试我的程序
最佳答案
嗯,晚了两年,但我们开始吧。
据我所见,您使用的是 Windows。我遇到了同样的问题并很快解决了。显然这是一些系统错误。要解决,请按照以下步骤操作:
(在 Windows 10 上测试)
转到 Windows 控制面板(您可以通过打开文件资源管理器并在路径中键入“控制面板”(不带引号)并按 Enter 键来执行此操作);
在“控制面板”中,单击“时钟和区域”。
单击区域。将打开一个新屏幕。
在打开的屏幕中,单击“管理”并搜索“更改系统位置”按钮。
选中选项:“Beta:使用 Unicode UTF-8 支持世界语言”
重新启动计算机。
通过执行此过程,问题将得到解决。 我希望它对您和遇到此问题的其他人有所帮助。
关于visual-studio-code - 无法从命令环境 cd 开始调试意外的 gdb 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56363761/