Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

miDebuggerPath invalid #2925

Closed
theOne-Phil opened this issue Dec 13, 2018 · 18 comments
Closed

miDebuggerPath invalid #2925

theOne-Phil opened this issue Dec 13, 2018 · 18 comments
Assignees
Labels
debugger more info needed The issue report is not actionable in its current state

Comments

@theOne-Phil
Copy link

I am unable to find out, why miDebuggerPath is invalid.

Setup:

OS: Windows 10
I am coding in C
C/C++ Extension by Microsoft is installed
MinGW installed

Issue:

image

my launch.json

image

location of gdb.exe

image

So with all these working together I have no clue why it is unable to find the gdb.exe
Any help appreciated!
Thanks ~Phil

@WardenGnaw
Copy link
Member

Can you get the engine logging and paste it here?

@WardenGnaw WardenGnaw added debugger more info needed The issue report is not actionable in its current state labels Dec 15, 2018
@WardenGnaw WardenGnaw self-assigned this Dec 15, 2018
@theOne-Phil
Copy link
Author

theOne-Phil commented Dec 15, 2018

1: (85) LaunchOptions WorkingDirectory='C:\QS_SurfacePro\FHS\SWE'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (85) LaunchOptions ExeArguments=''\r\n"},"seq":8,"type":"event"}
1: (85) LaunchOptions ExeArguments=''
--> E (output): {"event":"output","body":{"category":"console","output":"1: (85) LaunchOptions MIMode='gdb'\r\n"},"seq":10,"type":"event"}
1: (85) LaunchOptions MIMode='gdb'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (85) LaunchOptions MIDebuggerPath='‪‪‪C:\MinGW\bin\gdb.exe'\r\n"},"seq":12,"type":"event"}
1: (85) LaunchOptions MIDebuggerPath='‪‪‪C:\MinGW\bin\gdb.exe'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (85) LaunchOptions WaitDynamicLibLoad='false'\r\n"},"seq":14,"type":"event"}
1: (85) LaunchOptions WaitDynamicLibLoad='false'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (86) LaunchOptions ExternalConsole='true'\r\n"},"seq":16,"type":"event"}
1: (86) LaunchOptions ExternalConsole='true'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (86) LaunchOptions>\r\n"},"seq":18,"type":"event"}
1: (86) LaunchOptions>
--> E (output): {"event":"output","body":{"category":"console","output":"1: (86) LaunchOptions \r\n"},"seq":20,"type":"event"}
1: (86) LaunchOptions
--> E (output): {"event":"output","body":{"category":"console","output":"1: (86) LaunchOptions -enable-pretty-printing\r\n"},"seq":22,"type":"event"}
1: (86) LaunchOptions -enable-pretty-printing
--> E (output): {"event":"output","body":{"category":"console","output":"1: (87) LaunchOptions \r\n"},"seq":24,"type":"event"}
1: (87) LaunchOptions
--> E (output): {"event":"output","body":{"category":"console","output":"1: (87) LaunchOptions\r\n"},"seq":26,"type":"event"}
1: (87) LaunchOptions
--> E (output): {"event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/Launch","data":{"VS.Diagnostics.Debugger.ImplementationName":"Microsoft.MIDebugEngine","VS.Diagnostics.Debugger.EngineVersion":"14.0.51030.1","VS.Diagnostics.Debugger.HostVersion":"14.0.51030.1","VS.Diagnostics.Debugger.AdapterId":"cppdbg","VS.Diagnostics.Debugger.Launch.ErrorCode":1005,"VS.Diagnostics.Debugger.Launch.IsError":true}},"seq":28,"type":"event"}
--> R (launch-2): {"request_seq":2,"success":false,"command":"launch","message":"Unable to start debugging. The value of miDebuggerPath is invalid","body":{"error":{"id":1005,"format":"Unable to start debugging. The value of miDebuggerPath is invalid"}},"seq":30,"type":"response"}

@WardenGnaw
Copy link
Member

I'm quite stumped, too. The error message The value of miDebuggerPath is invalid only appears if that file does not exist.

Can you try running C:\MinGW\bin\gdb.exe --interpreter=mi in a command prompt and see if that works?

@theOne-Phil
Copy link
Author

image

@theOne-Phil
Copy link
Author

theOne-Phil commented Dec 19, 2018

I have tried to setup Visual Code with MinGW the same way on my computer, and got the same results.
The walktrhorugh is:

  • install MinGW
    • mingw32-base-bin
    • mingw32-gcc-g++-bin
    • adding mingw to PATH
  • install Visual Code
  • setup tasks in Visual Code (gcc -g FILE -o FILE.exe)
    • "command": "gcc",
    • "args": ["-g", "${file}", "-o", "${workspaceRoot}\${fileBasename}.exe"]
  • install ms-vscode.cpptools
  • setup launch
    • path to gdb.exe
    • add "compile task" as pretask

@WardenGnaw
Copy link
Member

Sadly I still can't repro the issue with your provided steps. Can you copy the launch.json file you were using here?

@theOne-Phil
Copy link
Author

theOne-Phil commented Dec 20, 2018

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": "${workspaceRoot}\\${fileBasename}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "‪C:\\MinGW\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "Build",
        }
    ]
}

@theOne-Phil
Copy link
Author

task.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Build",
            "type": "shell",
            "command": "gcc",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${workspaceRoot}\\${fileBasename}.exe"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
        },
        {
            "label": "RunCFile",
            "type": "shell",
            "command": ".\\${fileBasename}.exe",
            "group": {
                "kind": "test",
                "isDefault": true
            }
        }
    ]
}

@theOne-Phil
Copy link
Author

Maybe dump MinGW for something else?

@WardenGnaw
Copy link
Member

WardenGnaw commented Dec 20, 2018

I just copied your launch.json, and I also got the same failure.

There is no visible difference between the two strings so I wrote a simple program to see whats going on.

image

Your string printed out character by character is:

"miDebuggerPath": "?C:\\MinGW\\bin\\gdb.exe",
34 109 105 68 101 98 117 103 103 101 114 80 97 116 104 34 58 32 34 8234 67 58 92 92 77 105 110 71 87 92 92 98 105 110 92 92 103 100 98 46 101 120 101 34 44

When the expected is:

"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
34 109 105 68 101 98 117 103 103 101 114 80 97 116 104 34 58 32 34 67 58 92 92 77 105 110 71 87 92 92 98 105 110 92 92 103 100 98 46 101 120 101 34 44

Theres a weird 8234 character in your string, which printing it rendered it as '?'.

Try replacing this string below with your current one:
"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe"

@theOne-Phil
Copy link
Author

theOne-Phil commented Dec 20, 2018

I copied your string, and get a Syntax-Error:
image

But after adding '\' it works!! :D i am so happy right now!
image

THANK YOU! ❤️
I will look into this char element, since I edited the launch.json manually on PC and on my Surface...

@reservoirinvest
Copy link

I just copied your launch.json, and I also got the same failure.

There is no visible difference between the two strings so I wrote a simple program to see whats going on.

image

Your string printed out character by character is:

"miDebuggerPath": "?C:\\MinGW\\bin\\gdb.exe",
34 109 105 68 101 98 117 103 103 101 114 80 97 116 104 34 58 32 34 8234 67 58 92 92 77 105 110 71 87 92 92 98 105 110 92 92 103 100 98 46 101 120 101 34 44

When the expected is:

"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
34 109 105 68 101 98 117 103 103 101 114 80 97 116 104 34 58 32 34 67 58 92 92 77 105 110 71 87 92 92 98 105 110 92 92 103 100 98 46 101 120 101 34 44

Theres a weird 8234 character in your string, which printing it rendered it as '?'.

Try replacing this string below with your current one:
"miDebuggerPath": "C:\MinGW\bin\gdb.exe"

I had the exact same problem and was struggling. It really is wierd.

Looks like manually editing file in JSON in vs code introduces extra invisible characters. This would be a question to developers?

@lvZic
Copy link

lvZic commented Apr 9, 2020

thank god!
in my opinion, it may be somthiing about ANSI coding

@gtsompanoglou
Copy link

"miDebuggerPath":"C:\TDM-GCC-64\bin\gdb.exe"

This saved my day (: . If you are reading this you should definately try it.

@dvogureckiy99
Copy link

@gtsompanoglou gtsompanoglou
Where is situated TDM-GCC-64\bin\gdb.exe execpt you example ?

@nested-slk
Copy link

image
Check the End of line setting

@TTFH
Copy link

TTFH commented Dec 15, 2023

If you're using Makefile Tools, edit the settings.json (NOT launch.json) and make sure the paths starts with a lowercase 'c'.

	"makefile.launchConfigurations": [
		{
			"cwd": "path to folder with exe",
			"binaryPath": "path to exe",
			"binaryArgs": [],
			"MIMode": "gdb",
			"miDebuggerPath": "c:\\msys64\\usr\\bin\\gdb.exe"
		}
	]
}

@KhaledT5
Copy link

KhaledT5 commented Apr 9, 2024

The solution that worked for me was that either you delete this line "C:\MinGW\bin\gdb.exe",
except gdb and the quotations, or the problem might be that minGW is downloaded within another folder in C drive. I don't know how it happened with me but i found that minGW was inside a folder named mingw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debugger more info needed The issue report is not actionable in its current state
Projects
None yet
Development

No branches or pull requests

9 participants