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

Add support for Debugging on Alpine #8101

Closed
wants to merge 1 commit into from
Closed

Conversation

WardenGnaw
Copy link
Member

This enables Debug Launch/Attach for Linux-x64 Alpine.

Addresses debugging scenario for #4827

Added notes via TODO(LS-alpine) when Language Service has alpine support so we can have a full activation instead of a debugger only version.

Tested using remote-container with the following configurations:

Dockerfile
FROM mcr.microsoft.com/vscode/devcontainers/base:dev-alpine-3.14

RUN apk add --no-cache gdb file g++ clang coreutils
devcontainer.json
{
	"name": "Alpine",
	"build": {
		"dockerfile": "Dockerfile",
		// Update 'VARIANT' to pick an Alpine version: 3.11, 3.12, 3.13, 3.14
		"args": { "VARIANT": "3.14" }
	},
	
	// Set *default* container specific settings.json values on container create. 
	"settings": {},

	// Add the IDs of extensions you want installed when the container is created.
	// Note that some extensions may not work in Alpine Linux. See https://aka.ms/vscode-remote/linux.
	"extensions": [
		"ms-vscode.cpptools"
	],

	// 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": "uname -a",

	// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
	// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],

	// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
	"remoteUser": "vscode"
}

@WardenGnaw WardenGnaw self-assigned this Sep 3, 2021
@WardenGnaw
Copy link
Member Author

Also a huge thanks to @Trass3r for the help and validation for this scenario.

@@ -22,6 +23,16 @@ export function GetOSName(processPlatform: string | undefined): string | undefin
}
}

let _isAlpine: boolean | undefined;

export function IsAlpine(): boolean {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

functions should be named like isAlpine

Separate initialize method for Alpine until we can use the regular 'initialize' method.

This enables attach and cppdbg for alpine without snippets or 'Build and Debug Active file'
since we do not have a language service.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want one? What would it take for us to make it work? It would be better if we could just support the platform across the board.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets discuss this in our next meeting.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well the current one is glibc-based.

@Trass3r
Copy link

Trass3r commented Oct 5, 2021

Any updates?

@WardenGnaw
Copy link
Member Author

@Trass3r We are planning on fully adding Alpine support for both the Language Service and Debugger.

The current plan is targeted for 1.8.0.

@Trass3r
Copy link

Trass3r commented Oct 6, 2021

I see. But that will take a while.
In the meantime couldn't it "simply" be changed to reference the correct debugger package so these steps become unnecessary?

@WardenGnaw
Copy link
Member Author

The activation of the extension depends on a bunch of the checks I added to disable the Language Service.
See // TODO(LS-alpine) in the changes.

The simple change is to fix the download for alpine machines since we download the linux-x64 one based on the logic in download packages.

export function PlatformsMatch(value: IPackage, info: PlatformInformation): boolean {
    if (IsAlpine()) {
        // Alpine needs to be explicitly stated in packages list in order to be downloaded.
        return value.platforms && value.platforms.indexOf("alpine-linux") !== -1;
    }

    return !value.platforms || value.platforms.indexOf(info.platform) !== -1;
}

@Colengms
Copy link
Collaborator

@WardenGnaw Can this PR be abandoned, now that we support Alpine x64?

@WardenGnaw
Copy link
Member Author

Closing in favor for 1.8.0-insiders3

@WardenGnaw WardenGnaw closed this Jan 19, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Mar 5, 2022
@bobbrow bobbrow deleted the dev/waan/alpine branch March 28, 2024 00:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants