Closed mipnw closed 2 years ago
Thanks for the report. Looks like the result from delve doesn't seem to match the assumption made here
This is a bug in the legacy debug adapter (which we no longer actively maintain). Can you test if the new debug adapter handles this better?
Adding "debugAdapter": "dlv-dap"
to the launch configuration will make the extension to use the new adapter for remote/attach
mode (See
https://github.com/golang/vscode-go/blob/master/docs/debugging.md#connecting-to-headless-delve-with-target-specified-at-server-start-up).
If it doesn't work, can you please capture the delve's log (--log-output=dap
) and share? Thanks!
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_. - 1.17.8 * Run `gopls -v version` to get version of Gopls from _the VS Code integrated terminal_. - 0.8.3 * Run `code -v` or `code-insiders -v` to get version of VS Code or VS Code Insiders. - 1.66.2 * Check your installed extensions to get the version of the VS Code Go extension - 0.32.0 * Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > `Go: Locate Configured Go Tools` command. ``` Checking configured tools.... GOBIN: undefined toolsGopath: gopath: /Users/mipnw/go GOROOT: /usr/local/Cellar/go/1.17.8/libexec PATH: /usr/local/opt/coreutils/libexec/gnubin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/go/bin:/Users/mipnw/bin/google-cloud-sdk/bin:/Users/mipnw/go/bin:/Applications/Visual Studio Code.app/Contents/Resources/app/bin:/Users/mipnw/Library/Python/3.8/bin/ go: /usr/local/bin/go: go version go1.17.8 darwin/amd64 go-outline: /Users/mipnw/go/bin/go-outline (version: v0.0.0-20210608161538-9736a4bde949 built with go: go1.17) gotests: /Users/mipnw/go/bin/gotests (version: v1.6.0 built with go: go1.17) gomodifytags: /Users/mipnw/go/bin/gomodifytags (version: v1.14.0 built with go: go1.17) impl: /Users/mipnw/go/bin/impl (version: v1.1.0 built with go: go1.17) goplay: /Users/mipnw/go/bin/goplay (version: v1.0.0 built with go: go1.17) dlv: /Users/mipnw/go/bin/dlv (version: v1.7.1 built with go: go1.17) staticcheck: /Users/mipnw/go/bin/staticcheck (version: v0.2.1 built with go: go1.17) gopls: /Users/mipnw/go/bin/gopls (version: v0.8.3 built with go: go1.17.8) go env Workspace Folder (checkimage): /Users/mipnw/src/mipnw/checkimage GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/mipnw/Library/Caches/go-build" GOENV="/Users/mipnw/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/mipnw/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/mipnw/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/Cellar/go/1.17.8/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.17.8/libexec/pkg/tool/darwin_amd64" GOVCS="" GOVERSION="go1.17.8" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/mipnw/src/mipnw/checkimage/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/mv/13x0c0p510119w7702_qf73s9rwdhc/T/go-build638434252=/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 thego.
or["go"]
orgopls
prefixes.Describe the bug
VSCode debugger attached to a headless dlv debugger errors when stepping over a line of source code. The VSCode's debug console shows this error
Steps to reproduce the behavior:
Clone https://github.com/mipnw/checkImage and follow the README.md instructions which are essentially copied here.
That git repo contains the VSCode launch configuration, the Dockerfile specifying how to build the docker image with a trivial go app and dlv.
make docker-build
builds that image,make debug
runs the container with dlv listening 2345.Set a breakpoint on [$GOPATH]/pkg/mod/github.com/google/go-containerregistry@v0.8.0/pkg/v1/remote/descriptor.go line 106, and launch the VSCode launch configuration to debug. The breakpoint will hit, step over, VScode's debug console should show the error pasted above, and the headless dlv will receive
debugger detaching
which exits the container.Dockerfile
Makefile
launch.json
Screenshots or recordings
n/a