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.

3

7 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.

2

I had the same problem, my solution was:

1. Change this section in launch.json

"miDebuggerPath": "/usr/bin/gdb", 

for:

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

2. Do you need to install in your PC MinGW, this is the link:

https://osdn.net/projects/mingw/downloads/68260/mingw-get-setup.exe/

3. Next, open the MinGW then you install in the URL "C:/MinGW/bin" the gdb (select)

mingw32-gdb-bin 

4. Enjoy the vs-code

3

it should be

"miDebuggerPath": "/usr/bin/gdbus", 
1

If you're running under WSL, you should check where gdb is in your current distro to set your "miDebuggerPath" using

whereis gdb 

in my case it was in

/usr/bin/gdb 

but it could be somewhere else, that depends on what Linux distribution are you using with WSL

I had the similar problem, running on linux. Installing gdb fixed it.

Could you try this:

sudo apt install binfmt-support 

I am using VcXsrv, and this fixed all my installation problems, including chrome and GNU C++.

i had a similar problem ,this fixed. WINDOWS 10

QUICK ANSWER : try 1)C:\your compiler\bin\gdb.exe (paste your compiler path ) or 2)C:\TDM-GCC-32\bin\gdb32.exe for 32 bit compiler .(in my case)

(i tried to use opengl GLFW glad with 32bit tdm-gcc c++ compiler , i used a repo from OpenGL C++ template by vkphillia

but when i tried to run it in vs code using "run without debugging " option ,it showed the error "Unable to start debugging : The value of miDebuggerPath is invalid",

i copied my tdm_gcc compiler's bin path in midebugger path and it was like this , C:\TDM-GCC-32\bin\gdb.exe , but it did not remove the error then i checked for the gdb.exe application in my tdm gcc compiler bin where i noticed that there was no gdb.exe but a gdb32.exe file

ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJobG9rZGl%2BeYKOrqWampyaerW7jKyrmqqkYrGmrtSgnqKml2LBqbGMr5ilrZVivKd5zKKbnpqlnLSmvs%2Baq6Flmah6qrrVmqOinA%3D%3D