microsoft / vscode-makefile-tools

MAKE integration in Visual Studio Code
Other
194 stars 58 forks source link

[BUG] Debugging not working with `flatpak` #540

Closed pioupia closed 2 weeks ago

pioupia commented 9 months ago

Hello, It seems that the extension does not work when Visual Studio Code is launched with Flatpak. Indeed, when a debug is launched, in the Visual Studio code debug console page, GDB returns the following error: `ERROR: Unable to start debugging. GDB exited unexpectedly. I'd like to point out that before Visual Studio Code was switched to Flatpak, it worked correctly.

In order to launch a correct bash session, some configurations had to be modified, so I'm attaching our user.json configuration:

"terminal.integrated.defaultProfile.linux": "zsh",
    "terminal.integrated.profiles.linux": {
        "bash": {
            "path": "/usr/bin/flatpak-spawn",
            "icon": "terminal-bash",
            "args": [
                "--host",
                "--env=TERM=xterm-256color",
                "bash"
            ]
        },
        "zsh": {
            "path": "/usr/bin/flatpak-spawn",
            "args": [
                "--host",
                "--env=TERM=xterm-256color",
                "zsh"
            ]
        },
    },

I think the extension is trying to run the gdb program in a way that doesn't give it access to files or environment variables.

Without the bash configuration set in the user parameters, the bash we have has no environment variables and is buggy. This may be due to the fact that, as the application is launched with Flatpak, the command flatpak-spawn --host should be used to give GDB access to the data required for it to function correctly.

If we set the line terminal.integrated.defaultProfile.linux to bash, and we set the path of the bath profile to /usr/bin/bath, the debugger is working correctly, but not the shell anymore.

I don't know if it was clear, but I'm trying to explain something I don't really understand.

This issue is related to this one I think: https://github.com/microsoft/vscode/issues/140261

gcampbell-msft commented 2 weeks ago

This seems to be the same exact issue, but simply in a different location, as this bug #493. #493 is referring specifically to tasks, this item is specific to debug and launch configurations.

gcampbell-msft commented 2 weeks ago

@pioupia I believe I have a possible fix for you.

Could you please download the below file, change the file extension from .zip to .vsix, and then install the extension manually into VS Code and test?

Thank you !

makefile-tools.zip

pioupia commented 2 weeks ago

Hi @gcampbell-msft , I'm sorry to tell you this, but unfortunately the problem was occurring on my school's computers, which subsequently decided to remove VSCode from the Flatpack installation, which solved this problem as well as many others. It is therefore not possible for me to reproduce the problem.

gcampbell-msft commented 2 weeks ago

@pioupia I understand, thank you for letting me know, I appreciate it!

In light of this information, I'll go ahead and close the issue. I believe I've tested locally and we have other issues that may be able to provide confirmation as well.

Thanks again for letting us know!