microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.67k stars 289 forks source link

Debugger not started when C++ extension is installed on a bind-mounted volume #4587

Closed fgropengieser closed 3 years ago

fgropengieser commented 3 years ago

Environment

Bug description When the C++ Extension is installed on a bind-mounted folder and I run the debug launch configuration, the debug toolbar (with pause, step and so on) shows up but then immediately debugging exits without ANY feedback and ANY logs. If I install the C++ Extension inside the container, everything works as expected.

Steps to reproduce

  1. Create a dev container with the C++ docker file provided by Microsoft Remote-Containers extension using Ubuntu 18.04. Below is my devcontainer.json file:

    {
    "name": "C++",
    "build": {
        "dockerfile": Dockerfile"
    },
    "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"],
    
    // Set *default* container specific settings.json values on container create.
    "settings": {
        "terminal.integrated.shell.linux": "/bin/bash"
    },
    
    // Add the IDs of extensions you want installed when the container is created.
    "extensions": [
        "ms-vscode.cpptools"
    ],
    "mounts": ["source=<YOUR_FOLDER>/.vscode-server, target=/root/.vscode-server,type=bind,consistency=delegate" ]
    // Use 'forwardPorts' to make a list of ports inside the container available locally.
    // "forwardPorts": [],
    
    // Use 'postCreateCommand' to run commands after the container is created.
    // "postCreateCommand": "gcc -v",
    
    // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
    //"remoteUser": "vscode"
    }
  2. Create a helloWorld.cpp file in your workspace:
    
    #include <iostream>

int main() { std::cout << "Hello World!"; return 0; }


2. Compile it with g++ -g helloWorld.cpp -o hello .
3. Set a breakpoint somewhere in the helloWorld.cpp .
4. Create a launch configuration:

{ "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/hello", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "console": "externalTerminal", "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] } ] }


5. Run the configuration.
2percentsilk commented 3 years ago

@chrmarti are you aware of any issues that may cause this in Remote-Containers? Or is it a C++ extension issue?

fgropengieser commented 3 years ago

I should mentioned that I already opened a ticket couple of month ago for the cpp extension: https://github.com/microsoft/vscode-cpptools/issues/6541 ... However it was closed with reason that it might be a container extension issue.

chrmarti commented 3 years ago

It works without the mount and it doesn't when the mount is there. So it seems to be an interaction between the C++ extension and that mount point. It also works when using a volume mount, you could use that as a workaround: "mounts": ["source=vscode-server-volume,target=/home/root/.vscode-server,type=volume"]

/cc @WardenGnaw

github-actions[bot] commented 3 years ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!