Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unable to start debugging unexpected gdb output from command environment cd

I want to lauch gdb in vscode. I want to debug my c code using gdb in vscode , but i m getting following error :

unable to start debugging unexpected gdb output from command environment cd I have my gdb installed on wsl.

here is my lauch.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",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ],
        "pipeTransport": {
            "pipeCwd": "",
            "pipeProgram": "c:\\windows\\sysnative\\bash.exe",
            "pipeArgs": ["-c"],
            "debuggerPath": "/usr/bin/gdb"
        },
        "sourceFileMap": {
            "/mnt/z": "z:\\"
        }
    }
]

}

I am unable to debug my program

like image 825
Nidhi Khanna Avatar asked Dec 08 '25 09:12

Nidhi Khanna


1 Answers

Well, two years too late, but here we go.

From what I saw, you are using windows. I had the same problem and quickly resolved it. Apparently it's some system bug. To resolve, follow these steps:

(Tested on Windows 10)

  1. Go to Windows Control Panel (You can do this by opening File Explorer and in the path type 'Control Panel' (without quotes) and hit Enter);

  2. From the Control Panel, click on 'Clock and Region'.

  3. Click Region. A new screen will open.

  4. In the screen that opened, click on Administrative and search for the button "Change system location".

  5. Check the option: "Beta: Use Unicode UTF-8 for world language support"

  6. Restart the computer.

By doing this procedure, the problem will be solved. I hope it has helped you and others who are experiencing this problem.

like image 163
Luan Florencio Avatar answered Dec 10 '25 05:12

Luan Florencio