Debugger fails when breakpoints are set
vkalinsky opened this issue · comments
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
- Run
go version
to get version of Go from the VS Code integrated terminal.- go version go1.22.3 darwin/amd64
- Run
gopls -v version
to get version of Gopls from the VS Code integrated terminal.- golang.org/x/tools/gopls v0.15.3
- Run
code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.- 1.88.0
- Check your installed extensions to get the version of the VS Code Go extension
- v0.41.4
- Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) >
Go: Locate Configured Go Tools
command.Tools Configuration
Environment
GOBIN: undefined
toolsGopath:
gopath: /Users/vkalinsky/go
GOROOT: /usr/local/go
PATH: /usr/local/go/bin:/Library/Frameworks/Python.framework/Versions/3.12/bin:/Users/vkalinsky/bin:/Users/vkalinsky/go/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/share/dotnet:/.dotnet/tools/.dotnet/tools
PATH (vscode launched with): /Library/Frameworks/Python.framework/Versions/3.12/bin:/Users/vkalinsky/bin:/Users/vkalinsky/go/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/share/dotnet:
Tools
go: /usr/local/go/bin/go: go version go1.22.3 darwin/amd64
gopls: /Users/vkalinsky/go/bin/gopls (version: v0.15.3 built with go: go1.22.3)
gotests: /Users/vkalinsky/go/bin/gotests (version: v1.6.0 built with go: go1.22.3)
gomodifytags: /Users/vkalinsky/go/bin/gomodifytags (version: v1.16.0 built with go: go1.22.3)
impl: /Users/vkalinsky/go/bin/impl (version: v1.1.0 built with go: go1.22.3)
goplay: /Users/vkalinsky/go/bin/goplay (version: v1.0.0 built with go: go1.22.3)
dlv: /Users/vkalinsky/go/bin/dlv (version: v1.22.1 built with go: go1.22.3)
staticcheck: /Users/vkalinsky/go/bin/staticcheck (version: v0.4.7 built with go: go1.22.3)
Go env
Workspace Folder (godebug): /private/tmp/godebug
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/Users/vkalinsky/Library/Caches/go-build'
GOENV='/Users/vkalinsky/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/vkalinsky/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/vkalinsky/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.22.3'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/private/tmp/godebug/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/b5/b3pfl8m11dq8w8j342y_vt2m0000gn/T/go-build3378305753=/tmp/go-build -gno-record-gcc-switches -fno-common'
Share the Go related settings you have added/edited
Run Preferences: Open Settings (JSON)
command to open your settings.json file.
Share all the settings with the go.
or ["go"]
or gopls
prefixes.
...
"go.gopath": "/Users/username/go",
"go.delveConfig": {
"debugAdapter": "legacy"
}
....
Describe the bug
Can't debug any golang program when a breakpoint is set.
With legacy debug adapter it prints this error:
API server listening at: 127.0.0.1:33653
unexpected fault address 0x2c48ea0
Failed to continue - EOF
Unhandled error in debug adapter: UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "EOF".
With default adapter settings debugging at least started but then it fails on breakpoint:
runtime: g 1: unexpected return pc for runtime.sigpanic called from 0x1c2e009
stack: frame={sp:0xc00009aed0, fp:0xc00009af00} stack=[0xc00009a000,0xc00009b000)
...
Steps to reproduce the behavior:
- Write a simple "hello world" app
- Set breakpoint
- Debug the app
Reinstalling golang, the extension, vscode itself, clearing all GOPATH/GOROOT and all vscode settings didn't help.
I tried to reproduce the problem with Code 1.88.1, gopls v0.15.3, go at tip, and dlv 1.22.1, using both legacy and default debug adapter, but breakpoint stepping worked fine in both cases.
@mpratt, any idea what that "unexpected return pc for runtime.sigpanic" message is trying to tell us? Why would a
"hello, world" program (no cgo, no profiling, no use of runtime.Callers) be encountering sigpanic?
Probably it's something with delve itself. I tried to debug the same package in terminal and it failed too. The extension could handle it better (how?) , but the core problem is that go debugging doesn't work on my laptop.
Type 'help' for list of commands.
(dlv) break main.main
Breakpoint 1 set at 0x6493eae for main.main() ./main.go:5
(dlv) continue
> main.main() ./main.go:5 (PC: 0x6493eae)
Command failed: EOF
(dlv)```
OK, Internet, if golang debug in Visual Studio Code doesn't work on MacOS and fails with "broken pipe", "sigpanic" or "Command failed: EOF", it's most likely not the extension's fault. Try to debug it in terminal (my post above), and if it fails, re-install XCode command line tools (even if xcode-select says it's already installed):
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
(source: go-delve/delve#3538 (comment))
@adonovan thank you for responding, issue is resolved.