Home > Software design >  C/C Debugger does not work in VSC despite correct config
C/C Debugger does not work in VSC despite correct config

Time:11-20

If I try to run a debugging session on Visual Studio Code with C I get this error.

This is my config, I want the debugging session to launch in the VSC terminal using WSL.

    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "/usr/bin/gdb", //here :(
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
      

    ]
}

G and GDB are both installed locally and WSL.I tried using all these directories for the "miDebuggerPath" path; did not work.

CodePudding user response:

You need to change the miDebuggerPath to the path where gdb is installed in your WSL-environment.

So you have to set miDebuggerPath to:

"miDebuggerPath": "/usr/share/gdb",

when you wanto to run gd in a WSL-Environment. Change it to

"miDebuggerPath": "C:/MinGW/bin/gdb.exe",

when you want to debug in Windows.

CodePudding user response:

Install C/C extension on WSL Remote Subsystem even if you have it locally installed.

  • Related