Unable to start debugging : The value of miDebuggerPath is invalid - visual-studio

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.

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.

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

it should be
"miDebuggerPath": "/usr/bin/gdbus",

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

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

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

Related

GO permissions issue for Visual Studio Code (MAC OS Big Sur 11.3.1)

I was wondering if you could help me with this issue I've really been struggling with recently.
I have recently installed Visual Studio Code and GO in order to work on a few projects and I have run into this error when attempting to download the GO extensions for my IDE;
Installing github.com/fatih/gomodifytags#latest FAILED
{
"killed": false,
"code": 1,
"signal": null,
"cmd": "/usr/local/go/bin/go install -v
github.com/fatih/gomodifytags#latest",
"stdout": "",
"stderr": "go: could not create module cache: mkdir /Users/go:
permission denied\n"
}
Every single attempt to install a GO related file on my IDE has been met with a permissions denial.
sudo chown -R your_name:admin $((go env GOROOT))

Auto run a command when terminal opens in Visual Studio Code on Mac

I'd like to run the command reload -b whenever a terminal opens in Visual Studio Code on a Mac. The accepted answer to a similar question gives a deprecated warning.
I've set my default profile (ZSH) and configured it as suggested in the docs, but the command still doesn't run.
Any help is much appreciated - thanks
My settings.json looks like:
"terminal.integrated.defaultProfile.osx": "zsh",
"terminal.integrated.defaultProfile.windows": "zsh",
"terminal.integrated.profiles.osx": {
"zsh (login)": {
"path": "zsh",
"args": [
"reload -b"
]
}
},

visual studio code debug code does not match gopath using golang

visual studio code using golang debugger does not match the gopath path code ?
I construct up golang environment using visual studio code IDE MAC OS, then install the necessary tools:
go get -v -u github.com/peterh/liner github.com/derekparker/delve/cmd/dlv
go get -u -v github.com/nsf/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/golang/lint/golint
go get -u -v github.com/lukehoban/go-find-references
go get -u -v github.com/lukehoban/go-outline
go get -u -v sourcegraph.com/sqs/goreturns
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v github.com/tpng/gopkgs
go get -u -v github.com/newhook/go-symbols
I ever set my go path /Users/friends/gopath , before long I changed my gopath /Users/friends/Document/share/gopath. I changed the gopath ~/.bash_profile ,visual studio code setting about
go.gopath": "/Users/friends/Documents/VirtualMachine/share/gopath
when I debug my code, it tips that can't find the file in/Users/friends/gopath/src/...../apiSGetChainsIds.go , actually the file exist in /Users/friends/Documents/VirtualMachine/share/gopath/src/..../apiSGetChainsIds.go .It is obvious that the debugger find the previous gopath ,is it the golang tools bug? or something I wrong?
my usersetting is
{
"files.autoSave": "afterDelay",
//"go.buildOnSave": "package",
//"go.lintOnSave": "package",
//"go.vetOnSave": "package",
"go.buildFlags": [],
"go.lintFlags": [],
"go.vetFlags": [],
"go.useCodeSnippetsOnFunctionSuggest": false,
"go.formatOnSave": false,
"go.formatTool": "goreturns",
"editor.fontSize": 14,
"go.goroot": "/usr/local/Cellar/go/1.8.3/libexec",
"go.gopath": "/Users/friends/Documents/VirtualMachine/share/gopath"
}
I had also the problem to get it to run today, and here is what was necessary:
get your self delve (https://github.com/derekparker/delve)
either a) if you prefer to build and install it, clone the repo to
~/go/src/github.com/derekparker/delve
and then run:
go install github.com/derekparker/delve/cmd/dlv
because of latest macOS security updates, you need also to code sign it:
codesign -s dlv-cert $(which dlv)
or b) try brew
add a launch configuration into launch.json, my working looked as follows:
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceRoot}/myAppPackagePath/",
"cwd": "${workspaceRoot}",
"args": ["option1","option2","..."],
"showLog": true
}
]

Downgrade CoffeeScript Version

Recently, due to a problem, I had reinstall all my libraries which included CoffeeScript also. My problem is that my team has one version of CoffeeScript while I have a newer one. So every time we push code there is conflict in javascript. Any pointers on how I can downgrade CoffeeScript version in MAC OS would be really helpful.
Operation System: OS X El Capitan installed.
If you used NPM, install the older version of CoffeeScript with the following command:
npm install -g coffee-script#1.11.1
Close and reopen your terminal.
Check if you have the correct version installed:
coffee -v
On a side note, it might be better to maintain your project dependencies with package.json. That way, your team will always be in sync with the relevant package versions.
{
"name": "coffee-app",
"version": "1.0.0",
"main": "index.coffee",
"scripts": {
"start": "./node_modules/.bin/coffee index.coffee"
},
"dependencies": {
"coffee-script": "^1.11.1"
}
}
Just run npm install to install project dependencies.
And run npm start to start app with the correct "coffee version" for your app.

Sublime Text 2 OSX Grunt build system woe

I'm trying to use Sublime Text 2s build system to run a Grunt task. I have no issues using Grunt within Terminal. My setup works well on my Windows machine but my Mac hates it.
This is my .sublime-build configuration:
{
"selector": "grunt.js",
"working_dir": "${project_path}/js",
"windows": {
…
},
"osx": {
"cmd": ["grunt", "--no-color"]
}
}
And the output returned is:
[Errno 2] No such file or directory
The working directory and path returned are correct. My software versions are:
OSX 10.8.2
Node 0.8.9
NPM 1.1.68
Grunt 0.3.17
Sublime Text 2.0.1
Please save me any more frustrated Googling!
Make sure grunt is in your path with sublime (it can be different then your terminal path). To find the path type: npm bin -g. You can set the path in your sublime-build config:
{
"selector": "grunt.js",
"working_dir": "${project_path}",
"path": "/usr/local/bin",
"osx": {
"cmd": ["grunt", "--no-color"]
}
}
Just a nitpick, set the working_dir to the base project path. Not important as grunt will find up until it reaches a gruntfile but that will find the gruntfile slightly faster ;)

Resources