vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Trying to debug a C++ program for the first time in WSL with gdb in Ubuntu 20.04 but getting 'the value of miDebuggerPath is invalid.' What is launch.json file and how to set it up?

Open shahjacobb opened this issue 3 years ago • 1 comments

Environment

  • OS and version: Ubuntu 20.04 on Windows 10
  • VS Code: 1.71
  • C/C++ extension: Regular VScode store C++ extension pack....
  • OS and version of remote machine (if applicable):

Bug Summary and Steps to Reproduce

I am trying to debug a simple program with gdb for the first time in C++ and am totally lost and overwhelmed by this json stuff. I'm running Ubuntu 20.04 on Windows 10 and installed g++ using sudo apt install build-essential. When I compile and execute with g++ the programs execute just fine in the terminal. I don't want to debug via the terminal whatsoever. I get this error while debugging: 'the value of miDebuggerPath is invalid.'

It then tells me to set up a configuration file or something Idk what any of this stuff means man,

{
    // 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": []
}

Idk what a launch.json or task.json file is or what all the confusing keys/commands in the file mean and what value to set the 20 or keys/commands to in the launch.json file. It just spits out this empty confusing file above with no context. There's no good beginner-friendly tutorials online either. Can someone help me?


### Other Extensions

_No response_

### Additional Information

_No response_

shahjacobb avatar Sep 19 '22 03:09 shahjacobb

We have a walkthrough at https://code.visualstudio.com/docs/cpp/config-linux .

Does that solve your issue?

Normally, all you have to do is press the debug button in the top right of the file.

sean-mcmanus avatar Sep 19 '22 19:09 sean-mcmanus

Hello, I have the exact same issue and can't find a single solution online. Currently debugging by hand.

Working on WSL2, Ubuntu 20.08.

I've specified my debugger path inside of launch.json, and it still tells me "the value of miDebuggerPath is invalid".

What's odd is that specifying the include and compiler paths inside of c_cpp_properties.json is the exact same process, and vscode has no issue resolving those two.

Here's my launch.json file.

  "version": "0.2.0",
  "configurations": [
    {
      "name": "C/C++ Runner: Debug Session",
      "type": "cppdbg",
      "request": "launch",
      "args": [],
      "stopAtEntry": false,
      "externalConsole": false,
      "cwd": "/mnt/c/Users/berej/OneDrive/Documents/'Masters Suffering'/Code/cpp",
      "program": "/mnt/c/Users/berej/OneDrive/Documents/'Masters Suffering'/Code/cpp/build/Debug/outDebug",
      "MIMode": "gdb",
      "miDebuggerPath": "gdb",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ]
    }
  ]
}

DaPiePiece avatar Oct 10 '22 08:10 DaPiePiece

Hey @sean-mcmanus, this issue might need further attention.

@shahjacobb, you can help us out by closing this issue if the problem no longer exists, or adding more information.

github-actions[bot] avatar Dec 29 '22 11:12 github-actions[bot]

This issue has been closed because it needs more information and has not had recent activity.

github-actions[bot] avatar Feb 27 '23 11:02 github-actions[bot]

Hey not sure if im allowed to do this (noob) but it appears to be an issue. I can compile the using this commandline in Ubuntu 22.04 # g++ -o hello HelloWorld.cc #./hello Hello C++ World from VS Code and the C++ extension!

But in VS it errors.

and here are the VS terminal logs... literally says report it to github. lol

[2023-02-27 22:00:37.968] Server bound to 127.0.0.1:46097 (IPv4) [2023-02-27 22:00:37.968] Extension host agent listening on 46097 [2023-02-27 22:00:37.968] [2023-02-27 22:00:37.977] Started local proxy server on 64252. [2023-02-27 22:00:37.977] WSL resolver response: 127.0.0.1:64252 [2023-02-27 22:00:37.977] To debug connection issues, open a local browser on http://127.0.0.1:64252/version [2023-02-27 22:00:37.977] Using 'wslExeProxy' to connect to the VS Code server as configured by setting 'remote.WSL2.connectionMethod' [2023-02-27 22:00:37.977] 'wslExeProxy' should fix reconnection issues after sleep and network adapter changes. [2023-02-27 22:00:37.977] Please report issues related with the new setting to https://github.com/microsoft/vscode-remote-release/issues/5894 [2023-02-27 22:00:37.977] To revert back to the old way of connecting, change setting 'remote.WSL2.connectionMethod' to 'wsl2VMAddress'.

My process was launch VS from WSL2 Ubuntu_22.04. as i think about i dont see the g++ configuration option in VS. Once again noob to the github eco.

johngco avatar Feb 27 '23 22:02 johngco

Hi @johngco, your issue appears to be different and the message you shared says to report problems with the wslExeProxy setting to https://github.com/microsoft/vscode-remote-release/issues/5894 which is in another repository. It looks like you are getting disconnected and the maintainers at that repository might be able to help you out.

bobbrow avatar Feb 27 '23 23:02 bobbrow

Bob Thank you for the direction

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Bob Brown @.> Sent: Monday, February 27, 2023 6:22:38 PM To: microsoft/vscode-cpptools @.> Cc: JG Company @.>; Mention @.> Subject: Re: [microsoft/vscode-cpptools] Trying to debug a C++ program for the first time in WSL with gdb in Ubuntu 20.04 but getting 'the value of miDebuggerPath is invalid.' What is launch.json file and how to set it up? (Issue #9892)

Hi @johngcohttps://github.com/johngco, your issue appears to be different and the message you shared says to report problems with the wslExeProxy setting to microsoft/vscode-remote-release#5894https://github.com/microsoft/vscode-remote-release/issues/5894 which is in another repository. It looks like you are getting disconnected and the maintainers at that repository might be able to help you out.

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/vscode-cpptools/issues/9892#issuecomment-1447273447, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWIHN7WQMFHFLPOIUVYKLTLWZUZL5ANCNFSM6AAAAAAQPXPH2E. You are receiving this because you were mentioned.Message ID: @.***>

johngco avatar Feb 28 '23 13:02 johngco