microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.52k stars 1.55k forks source link

Debugger not starting #7530

Open andrea-nistico opened 3 years ago

andrea-nistico commented 3 years ago

Bug type: Debugger

I've been working with remote-ssh and c/c++ without any issue, all of a sudden I cannot start the debugger. Nothing changed, configuration files are the same as before but now when I start the debugger, I see for a couple of seconds the top debugging bar and then it disappears. No message on the console, nothing.

For this purpose, I created a simple project from scratch, and even there, the same issue appears.

To Reproduce launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/a.out",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "logging": { "engineLogging": true },
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "/usr/bin/gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": false
                }
            ]
        }
    ]
}

main.c

#include <stdio.h>
int main(){
    printf("ciao\n");
    return 1;
}

Compile with gcc -g main.c

As I stated before, this workflow worked for me, from one second to another it stopped working as intended and I have no idea why and how to fix it, any help is appreciated.

What I tried

Updates

I have tried with the wsl-remote extension and it is working as expected.

andrea-nistico commented 3 years ago

Tried to uninstall gdb from host and launch the debug session, the message "gdb" not found does not even appear as it should

seongbin9786 commented 3 years ago

I'm experiencing a similar issue. I can't start debugger and even intellisense is not working. The project config has never been changed for like 3 months.

I don't have any clue but, C/C++ (ms-vscode.cpptools) Extension keeps me requiring reloading VSCode, but reloading it doesn't make the message gone however I try.

I've struggled for hours and I decided to switch to Visual Studio for a moment.

andrea-nistico commented 3 years ago

I solved it by reinstalling the entire OS on my raspberry. Deleting everything related to VSCode on both machines didn't make the trick, only installing a fresh OS made it work, I wonder why this happened.

gigony commented 3 years ago

I also have similar errors.

With the wsl-remote extension, I cannot launch the debugger.

It worked before but after Windows 10 and VSCode are updated, it doesn't work somehow, showing that there is no /usr/bin/bash when it is actually available in WSL.

(I am curious why the message has a postfix ':' -- /usr/bin/bash:)

Version: 1.57.0-insider (user setup)
Commit: 286b643ecd231f66f3f2e67e1456f3c601838b46
Date: 2021-05-25T05:24:28.413Z (14 hrs ago)
Electron: 12.0.9
Chrome: 89.0.4389.128
Node.js: 14.16.0
V8: 8.9.255.25-electron.0
OS: Windows_NT x64 10.0.21387

ms-vscode.cpptools : v1.4.0-insiders2

image

It works with the regular VSCode release.

Version: 1.56.2 (user setup)
Commit: 054a9295330880ed74ceaedda236253b4f39a335
Date: 2021-05-12T17:13:13.157Z (1 wk ago)
Electron: 12.0.4
Chrome: 89.0.4389.114
Node.js: 14.16.0
V8: 8.9.255.24-electron.0
OS: Windows_NT x64 10.0.21387

ms-vscode.cpptools : v1.4.0-insiders2