cmd/go: breakpoints with dlv yields incorrect behaviour on tests #64854
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
Debugging
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
Milestone
Go version
go version go1.21.4 linux/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
go test ./...
or with VSCode visual debugging and no breakpointThe code in question is from an open source library: soypat/seqs#8 (comment). This comment is perhaps a bit confusing, but the TL;DR is if you clone the repo and run the test with
go test ./...
in that commit hash you'll get a different output than if you run the test with a breakpoint on theprintln
statement (I'm using VSCode default visual debugging withdlv
).I actually tried to replicate it on a computer with same OS, arch, go version and had to change the case a bit, here's the line on which you have to add the breakpoint to see the bug for a different computer (different commit hash than first case above).
Previous investigation
@Jorropo investigated this bug. The conversation is on slack. They arrived on a conclusion there was a compiler bug that occurs in
go version devel go1.22-2184a39477 Thu Dec 21 18:36:41 2023 +0000 linux/amd64
, though it is my understanding it is unrelated to this breakpoint bug I am detailing here.What did you expect to see?
I expected to see same behaviour, same things printed since there is no concurrency at play. Running test with
-race
yields no race.What did you see instead?
Values are different, and also variables take on "impossible" values. i.e: There are two
int
type variables, one variable is assigned the value of the other. On the following statement the variable values differ.First case
No breakpoint output:
Breakpoint output:
Second case
No breakpoint output:
With breakpoint output
The text was updated successfully, but these errors were encountered: