我最近开始研究 vscode。我想调试我的 C 代码。但是当我启动调试器时出现错误:无法开始调试。miDebuggerPath 的值无效。
我在 wsl 上安装了我的 gdb 。它的路径是/usr/bin/gdb。我已将相同的路径复制到 miDebuggerPath 中的 launch.json。
这是我的 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}/bin/main",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
} …Run Code Online (Sandbox Code Playgroud) gdb visual-studio visual-studio-code windows-subsystem-for-linux