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

cmd/compile: GOSSAHASH debugging switch needs to be accessible outside SSA #53937

Closed
dr2chase opened this issue Jul 18, 2022 · 3 comments
Closed
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge
Milestone

Comments

@dr2chase
Copy link
Contributor

From time to time when debugging the compiler, it is helpful to use the GOSSAHASH environment variable to switch modified code on/off to search for exactly where a bug has its effect. However, this is currently limited to the ssa package. In the past I've edited the code to make it accessible outside of ssa when I needed it, and then discarded the edit. This seems like a waste of time, I've done this more than once, so it should be refactored into base.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 18, 2022
@dr2chase dr2chase self-assigned this Jul 18, 2022
@gopherbot
Copy link

Change https://go.dev/cl/418015 mentions this issue: cmd/compile: refactor GOSSAHASH debugging to make it usable outside ssa package.

@laboger
Copy link
Contributor

laboger commented Jul 18, 2022

Is there any documentation on how GOSSAHASH can be used? I see GOSSAFUNC mentioned in cmd/compile/internal/ssa/README.md.

@dr2chase
Copy link
Contributor Author

Common case for me is to use it in conjunction with a program I wrote that uses it to implement a search (github.com/dr2chase/gossahash which could itself use better documentation). I added a comment to the new source code that might work for you, if it needs more, this is a good time to ask:

https://go-review.googlesource.com/c/go/+/418015/2/src/cmd/compile/internal/base/hashdebug.go

Oh, right away (checking my shell history for examples) I see a missing tweak GOMAXPROCS=1 gossahash -- ./make.bash, got to run the compiler single threaded if that is what is failing, if you want a good search.

@mknyszek mknyszek added this to the Go1.20 milestone Jul 20, 2022
@golang golang locked and limited conversation to collaborators Aug 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

4 participants