Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to start debugging : The value of miDebuggerPath is invalid

I recently started working on vscode. I wanted to debug my C code. But the moment I am launching the debugger getting Error : Unable to start debugging. The value of miDebuggerPath is invalid.

I have my gdb installed on wsl . It's path is /usr/bin/gdb. I have copied same path to launch.json in miDebuggerPath.

Here is my 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
            }
        ]
    }
]

}

It should not throw the error and I should able to launch my debugger.

like image 395
Nidhi Khanna Avatar asked May 28 '19 14:05

Nidhi Khanna


2 Answers

So this happened to me on WSL-Ubuntu. In my case gdb was broken because of unmet dependencies. Took a while to fix but once I reinstalled gdb properly in my WSL-Ubuntu, I finally got it working.

Installing gdb can be done on shell as

sudo apt-get install gdb

There can be multiple reasons why it could end up as broken, but once you fix gdb, vscode-debugging should be running. At the very least, you won't see that error popping.

like image 175
AzuxirenLeadGuy Avatar answered Nov 16 '22 00:11

AzuxirenLeadGuy


it should be

"miDebuggerPath": "/usr/bin/gdbus",
like image 31
bikpo Avatar answered Nov 16 '22 00:11

bikpo