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

x/tools/gopls: add a source action to see assembly for a range of lines #69122

Open
firelizzard18 opened this issue Aug 23, 2024 · 4 comments
Open
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@firelizzard18
Copy link
Contributor

firelizzard18 commented Aug 23, 2024

Is your feature request related to a problem? Please describe.
I wanted to understand why this allocates:

func normalize(v any) (any, typeCode, bool) {
	switch v := v.(type) {
	case string:
		return v, typeCodeString, true
	// ...
	}
}

Describe the solution you'd like
I'd like to be able to select a line and view the assembly for that line (or for a range of lines).

Describe alternatives you've considered
I can (and did) use "Browse amd64 assembly for normalize" but that doesn't scale well to larger functions.

Additional context
#67478

@findleyr
Copy link
Contributor

CC @adonovan

Since this is a gopls feature request, transferring to the Go issue tracker.

@findleyr findleyr changed the title Source action to see assembly for a range of lines x/tools/gopls: add a source action to see assembly for a range of lines Aug 28, 2024
@findleyr findleyr transferred this issue from golang/vscode-go Aug 28, 2024
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Aug 28, 2024
@gopherbot gopherbot added this to the Unreleased milestone Aug 28, 2024
@findleyr findleyr modified the milestones: Unreleased, gopls/backlog Aug 28, 2024
@findleyr
Copy link
Contributor

Prior art: https://github.com/loov/lensm

@adonovan
Copy link
Member

This is a reasonable request, though before we invest piecemeal in small improvements to the assembly UI, we should consider whether installing a more sophisticated disassembly visualization (including blocks and control-flow edges, similar to https://github.com/aclements/objbrowse or https://github.com/loov/lensm) is a better use of time.

As an immediate workaround, you can use the L%d line numbers in the third column to figure out which instructions belong to the source statement of interest.

@firelizzard18
Copy link
Contributor Author

@adonovan I’d be happy with visualization like that. I’m fine changing this issue to that if you’d like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants