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

Debug session cannot be started a second time, extension re-installation required #8371

Open
aallrd opened this issue Nov 5, 2021 · 2 comments
Labels

Comments

@aallrd
Copy link

aallrd commented Nov 5, 2021

Bug type: Debugger

Describe the bug

  • OS and Version: RHEL 7.6
  • VS Code Version: 1.6.1.0
  • C/C++ Extension Version: v1.7.1

I can successfully start a first debugging session of my C++ binary.
After stopping it, I cannot start anymore a debug session: the bottom bar turns orange and immediately back to normal.
Nothing seems to be logged anywhere, even with all logs enabled.
I have to uninstall the ms-vscode.cpptools extension, reload VSCode, and re-install the extension to debug again.
The problem is the same after the re-installation.

Here is my launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "mdsystem-tests",
            "type": "cppdbg",
            "request": "launch",
            "program": "/tmp/mdsystem",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "envFile": "${workspaceFolder}/.vscode/debug.env",
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "logging": {
                "engineLogging": true,
                "exceptions": true,
                "moduleLoad": true,
                "programOutput": true,
                "trace": true,
                "traceResponse": true,
            }
        }
    ]
}

I have recorded the issue:

  • Starting a debug session by pressing F5 to show that it works fine the first time
  • The debugger starts, logs in the debug console and the breakpoint is hit as expected
  • Disconnecting by pressing the red stop button in the debug menu bar
  • Pressing F5 after that does not work anymore
vscode-cpptools-debug-failed.mp4
@WardenGnaw
Copy link
Member

On the second F5, I don't see anything appear in the debug console which leads me to think VS Code is not activating the debug adapter.

Do you see this in VS Code v1.62?

@aallrd
Copy link
Author

aallrd commented Nov 8, 2021

I have the same issue with VSCode 1.62.
I actually went a bit further and it seems to be linked with the way we install the extension on the remote environment (we are using the remote-SSH extension).
Since our remote servers don't have internet access and #8152 is not yet implemented, I wrote a script plugged into the user ~/.bash_profile that downloads the cpptools-linux-latest.vsix from an internal server and installs it using the code CLI:

code --force --install-extension "cpptools-linux-latest.vsix"

This way, it should be "transparent" for the users, they just have to open a terminal and the extension will be installed without network errors.
This mechanism is somehow causing this issue because I am not able to reproduce the debugging error if I disable it and install the extension:

  • Manually from the CLI (same command as above)
  • Manually using the "Install from VSIX" button

Do you know where the issue could come from? I guess the debug adapter starts a shell process since I have since seen the below lines in the history, maybe it gets corrupted by my customization:

/usr/bin/env /bin/sh /tmp/Microsoft-MIEngine-Cmd-qqdlh1h4.uzv

Until #8152 is implemented, do you have a better way to "auto-magically" install the Linux extension so the users don't always have to do it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants