golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.87k stars 746 forks source link

debug: broken debug console when restarting debug session #2971

Closed suzmue closed 1 year ago

suzmue commented 1 year ago

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.21.1 darwin/amd64 * Run `code -v` or `code-insiders -v` to get version of VS Code or VS Code Insiders. - 1.82.0 * Check your installed extensions to get the version of the VS Code Go extension - v0.39.1 * Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > `Go: Locate Configured Go Tools` command. - Checking configured tools.... GOBIN: undefined toolsGopath: gopath: /Users/suzmue/go GOROOT: /usr/local/go PATH: /Users/suzmue/Library/Application Support/cloud-code/installer/google-cloud-sdk/bin:/Users/suzmue/.cargo/bin:/usr/local/git/git-google/bin:/usr/local/git/current/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/go/bin:/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:/Users/suzmue/go/bin:/Users/suzmue/google-cloud-sdk/bin PATH (vscode launched with): /Users/suzmue/.cargo/bin:/usr/local/git/git-google/bin:/usr/local/git/current/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/go/bin:/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:/Users/suzmue/go/bin go: /usr/local/go/bin/go: go version go1.21.1 darwin/amd64 gotests: /Users/suzmue/go/bin/gotests (version: v1.6.0 built with go: go1.21.0) gomodifytags: /Users/suzmue/go/bin/gomodifytags (version: v1.16.0 built with go: go1.21.0) impl: /Users/suzmue/go/bin/impl (version: v1.1.0 built with go: go1.21.0) goplay: /Users/suzmue/go/bin/goplay (version: v1.0.0 built with go: go1.21.0) dlv: /Users/suzmue/go/bin/dlv (version: v1.21.0 built with go: go1.21.1) staticcheck: /Users/suzmue/go/bin/staticcheck (version: v0.4.3 built with go: go1.21.0) gopls: /Users/suzmue/go/bin/gopls (version: v0.13.2 built with go: go1.21.0) go env Workspace Folder (helloWorld): /Users/suzmue/helloWorld GO111MODULE='' GOARCH='amd64' GOBIN='' GOCACHE='/Users/suzmue/Library/Caches/go-build' GOENV='/Users/suzmue/Library/Application Support/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='amd64' GOHOSTOS='darwin' GOINSECURE='' GOMODCACHE='/Users/suzmue/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='darwin' GOPATH='/Users/suzmue/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.21.1' GCCGO='gccgo' GOAMD64='v1' AR='ar' CC='clang' CXX='clang++' CGO_ENABLED='1' GOMOD='/Users/suzmue/helloWorld/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/2x/hlwbwjzd1vd4brlfs80676fw00fkl_/T/go-build1830144805=/tmp/go-build -gno-record-gcc-switches -fno-common'

Describe the bug

When restarting a debug session, the debug console does not display output from the new debug session and does not evaluate variables.

Steps to reproduce the behavior:

  1. Create a hello world program and put a breakpoint on fmt.Println("Hello, World!") main.go:
    
    package main

import ( "fmt" )

func main() { fmt.Println("Hello, World!") }


2. Click F5
3. Hit Restart
4. See broken debug console

### Screenshots or recordings
Start the debug session:
![Screenshot 2023-09-13 at 3 03 05 PM](https://github.com/golang/vscode-go/assets/6634754/6d154694-3e0d-49fa-8a90-989430c4a5e8)
Click Restart and try to continue debugging:
![Screenshot 2023-09-13 at 3 03 14 PM](https://github.com/golang/vscode-go/assets/6634754/85a13513-9bdf-44d2-acb1-78c98a9dbce7)

![Screenshot 2023-09-13 at 3 03 22 PM](https://github.com/golang/vscode-go/assets/6634754/e1a270b9-ea02-4eac-9548-44fb1553ce0d)

The expected output in the debug console should be:
![Screenshot 2023-09-13 at 3 03 35 PM](https://github.com/golang/vscode-go/assets/6634754/11460546-e28d-44b7-bbbd-eddb743836ca)
suzmue commented 1 year ago

This seems to likely be microsoft/vscode#192653 which is now closed upstream.

Confirmed that this is fixed on insiders so will close.