vscode-go icon indicating copy to clipboard operation
vscode-go copied to clipboard

VS Code breakpoint is not triggered when run in debugger mode in the latest update - Golang

Open nirajbhattad opened this issue 3 years ago • 4 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.19.1 windows/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.

    • golang.org/x/tools/gopls v0.9.5
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.

    • 1.71.2 x64
  • Check your installed extensions to get the version of the VS Code Go extension

    • v0.35.2
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.

    • Checking configured tools.... GOBIN: undefined toolsGopath: gopath: D:\Go\Projects GOROOT: C:\Program Files\Go PATH: C:\Program Files\Microsoft MPI\Bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0;C:\windows\System32\OpenSSH;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\dotnet;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn;C:\Program Files\Microsoft SQL Server\140\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn;C:\Program Files\Microsoft SQL Server\140\DTS\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Users\niraj.bhattad\Documents\apache-jmeter-5.2\bin;C:\Program Files (x86)\dotnet;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\ProgramData\chocolatey\bin;C:\Program Files\PuTTY;C:\Program Files (x86)\PuTTY;C:\Program Files (x86)\GnuWin32\bin;C:\Program Files\Kubernetes\Minikube;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Redis;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn;C:\Program Files\Azure Data Studio\bin;C:\Program Files\Go\bin;C:\Users\niraj.bhattad\AppData\Local\Microsoft\WindowsApps;C:\Users\niraj.bhattad\AppData\Local\Programs\Git\cmd;C:\sonar\sonar-scanner-3.3.0.1492\bin;C:\sonar\sonar-scanner-3.3.0.1492;C:\Program Files (x86)\Java\jre1.8.0_221\bin;D:\protoc-3.9.2-win64\bin;C:\Users\niraj.bhattad.dotnet\tools;C:\kube;D:\Go\Projects\bin;D:\Tools\Confluent-hub\bin;C:\Users\niraj.bhattad.dotnet\tools;C:\Users\niraj.bhattad\AppData\Local\Microsoft\WindowsApps;C:\Program Files\heroku\bin;C:\Program Files\Azure Data Studio\bin;C:\hugo\bin;C:\MinGW\bin;C:\Program Files\CodeBlocks\MinGW\bin;C:\Users\niraj.bhattad\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\niraj.bhattad\go\bin

    go: C:\Program Files\Go\bin\go.exe: go version go1.19.1 windows/amd64

Tools environment: GOPATH=D:\Go\Projects Installing 1 tool at D:\Go\Projects\bin in module mode. gopls

gotests:	D:\Go\Projects\bin\gotests.exe	(version: v1.6.0 built with go: go1.19.1)
gomodifytags:	D:\Go\Projects\bin\gomodifytags.exe	(version: v1.16.0 built with go: go1.19.1)
impl:	D:\Go\Projects\bin\impl.exe	(version: v1.1.0 built with go: go1.19.1)
goplay:	D:\Go\Projects\bin\goplay.exe	(version: v1.0.0 built with go: go1.19.1)
dlv:	D:\Go\Projects\bin\dlv.exe	(version: v1.9.1 built with go: go1.19.1)
staticcheck:	D:\Go\Projects\bin\staticcheck.exe	(version: v0.3.3 built with go: go1.19.1)
gopls:	D:\Go\Projects\bin\gopls.exe	(version: v0.9.5 built with go: go1.16)

go env Workspace Folder (go-testspace): d:\Go\Projects\src\go-testspace set GO111MODULE= set GOARCH=amd64 set GOBIN= set GOCACHE=C:\Users\niraj.bhattad\AppData\Local\go-build set GOENV=C:\Users\niraj.bhattad\AppData\Roaming\go\env set GOEXE=.exe set GOEXPERIMENT= set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOINSECURE= set GOMODCACHE=D:\Go\Projects\pkg\mod set GONOPROXY=stash.bms.bz set GONOSUMDB=stash.bms.bz set GOOS=windows set GOPATH=D:\Go\Projects set GOPRIVATE=stash.bms.bz set GOPROXY=https://proxy.golang.org,direct set GOROOT=C:\Program Files\Go set GOSUMDB=sum.golang.org set GOTMPDIR= set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64 set GOVCS= set GOVERSION=go1.19.1 set GCCGO=gccgo set GOAMD64=v1 set AR=ar set CC=gcc set CXX=g++ set CGO_ENABLED=1 set GOMOD=d:\Go\Projects\src\go-testspace\go.mod set GOWORK= set CGO_CFLAGS=-g -O2 set CGO_CPPFLAGS= set CGO_CXXFLAGS=-g -O2 set CGO_FFLAGS=-g -O2 set CGO_LDFLAGS=-g -O2 set PKG_CONFIG=pkg-config set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\NIRAJ~1.BHA\AppData\Local\Temp\go-build91195187=/tmp/go-build -gno-record-gcc-switches

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.

Describe the bug

When I try to debug the go code with breakpoints, below error is displayed on the terminal after a set of steps:

Starting: D:\Go\Projects\bin\dlv.exe dap --check-go-version=false --log=true --log-output=dap --listen=127.0.0.1:60925 from D:\Go\Projects\src\go-testspace DAP server listening at: 127.0.0.1:60925

Error: connection error: Error: read ECONNRESET dlv dap (25184) exited with code: 3221226528

Steps to reproduce the behavior:

  1. Go to Run -> Start debugging
  2. See in debug console - DAP server listening at: 127.0.0.1:60925
  3. connection error: Error: read ECONNRESET dlv dap (25184) exited with code: 3221226528

Screenshots or recordings

If applicable, add screenshots or recordings to help explain your problem. image image

Launch configuration:

{ "version": "0.2.0", "configurations": [ { "name": "Launch", "type": "go", "request": "launch", "mode": "auto", "showLog": true, "logOutput": "dap", "program": "${workspaceFolder}/main.go", "env": { "TIER": "development" }, "args": [], "substitutePath": [ { "from": "D:/Go/Projects/src/go-testspace", "to": "go-testspace/" } ] } ] }

nirajbhattad avatar Sep 15 '22 19:09 nirajbhattad

CC @suzmue @hyangah

See related (recent) stackoverflow question: https://stackoverflow.com/questions/73734904/golang-delve-debuuger-not-working-on-windows-10

Some recent regression with Delve+Windows?

findleyr avatar Sep 16 '22 18:09 findleyr

Looks like the binary couldn't run or the debug backend couldn't start at all for some reason. My first guess would be security setting.

Can you debug successfully with the dlv command line tool?

For example, if you run from D:\Go\Projects\src\go-testspace directory something like:

dlv.exe debug --log --log-output=debugger,rpc .  

what does it report?

hyangah avatar Sep 16 '22 18:09 hyangah

This is what the output looks like after running the command.

image

nirajbhattad avatar Sep 16 '22 19:09 nirajbhattad

Looks like command dlv cannot run either. (Looks like the debugger was killed) Is your system's security policy updated recently and blocks the debugger from running?

hyangah avatar Sep 19 '22 18:09 hyangah

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

gopherbot avatar Oct 20 '22 14:10 gopherbot