My system is in a state where the GoLand debugger dies whenever it hits any breakpoint in any unit test in any project. This is completely consistent and reproducible.
The unit test runs to completion if I remove the breakpoint.
Here is what the failure looks like:
About my system:
- MacOS 14.3.1
- x86_64
- GoLand 2023.3.5
- xcode-select version 2405.
- Go 1.21.6
GoLand debugger console output shows:
/usr/local/Cellar/go/1.21.6/libexec/bin/go test -c -o /....
/usr/local/Cellar/go/1.21.6/libexec/bin/go tool test2json -t ../GoLand.app/Contents/plugins/go-plugin/lib/dlv/mac/dlv --listen=127.0.0.1:53984 --headless=true --api-version=2 --check-go-version=false --only-same-user=false exec /
...
API server listening at: 127.0.0.1:53984
I've tried updating a few pieces of software. Some things (GoLand, maybe xcode) were lower version numbers when this started. I think that it started when I upgraded to go 1.21.6.
Update 2024-04-04
I can reproduce the problem without using GoLand. I created the project ~/go/src/hello
, and in this project I created the file cmd/go/main.go
as a 7-line Hello World file. I built it with go build cmd/hello/main.go
. Then I started a debugger as:
dlv --listen=127.0.0.1:64997 --headless=true exec main
In another terminal window, I connect to this debugger with:
dlv connect :64997
If I simply run the program (I run the dlv c
command), it works. The first window outputs "hello world" and "Exiting." The second window outputs "Process 2107 has exited with status 0".
But if I try to set a breakpoint -- I run break main.main
and then c
-- then the first window outputs
unexpected fault address 0xaaf0a20
And the second window outputs
> main.main() ./cmd/hello/main.go:5 (PC: 0xaaf0a2a)
Warning: debugging optimized function
Command failed: EOF