Repository: golang/vscode-go

Issue #1608: Attach mode hang forever when `cwd` is empty
Created: 2021-07-05T15:27:34Z
For asking questions, see:

GitHub Discussions (Q&A)
#vscode channel in Gophers Slack

Before filing an issue, please review our troubleshooting guides

Troubleshooting problems with debugging
Troubleshooting other problems

Please answer these questions before submitting your issue. Thanks!
What version of Go, VS Code & VS Code Go extension are you using?

Run go version to get version of Go from the VS Code integrated terminal.

go version go1.13.8 darwin/amd64


Run gopls -v version to get version of Gopls from the VS Code integrated terminal.

Build info
----------
golang.org/x/tools/gopls v0.7.0
    golang.org/x/tools/gopls@v0.7.0 h1:JQBHW81Gsyim6iDjUwGoPeSpXrSqwen3isPJLfDf=
    github.com/google/go-cmp@v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlr=
    github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+e=
    golang.org/x/mod@v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
    golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bw=
    golang.org/x/sys@v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S=
    golang.org/x/tools@v0.1.3-0.20210608163600-9ed039809d4c h1:Pv9gNyJFYVdpUAVZ=
    golang.org/x/xerrors@v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8c=
    mvdan.cc/gofumpt@v0.1.1 h1:bi/1aS/5W00E2ny5q65w9SnKpWEF/UIOqDYBILpo9rA=
    mvdan.cc/xurls/v2@v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=



Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
1.57.1
507ce72a4466fbb27b715c3722558bb15afa9f48
x64



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

0.26.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/fanbingxin/go
GOROOT: /Users/fanbingxin/local/go
PATH: /Users/fanbingxin/bin:/Users/fanbingxin/go/bin:/Users/fanbingxin/local/go/bin:/Users/fanbingxin/local/maven/bin:/Users/fanbingxin/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/go/bin:/Applications/Wireshark.app/Contents/MacOS

   gopkgs: /Users/fanbingxin/go/bin/gopkgs installed
   go-outline: /Users/fanbingxin/go/bin/go-outline installed
   gotests: gotests not installed
   gomodifytags: gomodifytags not installed
   impl: /Users/fanbingxin/go/bin/impl installed
   goplay: goplay not installed
   dlv: /Users/fanbingxin/go/bin/dlv installed
   dlv-dap: dlv-dap not installed
   staticcheck: staticcheck not installed
   gopls: /Users/fanbingxin/go/bin/gopls installed

go env
Workspace Folder (eggos): /Users/fanbingxin/go/src/github.com/icexin/eggos
	GO111MODULE="on"
	GOARCH="386"
	GOBIN=""
	GOCACHE="/Users/fanbingxin/Library/Caches/go-build"
	GOENV="/Users/fanbingxin/Library/Application Support/go/env"
	GOEXE=""
	GOFLAGS=""
	GOHOSTARCH="amd64"
	GOHOSTOS="darwin"
	GONOPROXY=""
	GONOSUMDB=""
	GOOS="linux"
	GOPATH="/Users/fanbingxin/go"
	GOPRIVATE=""
	GOPROXY="https://goproxy.cn"
	GOROOT="/Users/fanbingxin/local/go"
	GOSUMDB="sum.golang.org"
	GOTMPDIR=""
	GOTOOLDIR="/Users/fanbingxin/local/go/pkg/tool/darwin_amd64"
	GCCGO="gccgo"
	GO386="sse2"
	AR="ar"
	CC="clang"
	CXX="clang++"
	CGO_ENABLED="0"
	GOMOD="/Users/fanbingxin/go/src/github.com/icexin/eggos/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 -m32 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/f8/0879kt7j4791j6lrfz2ydb4h0000gp/T/go-build350734622=/tmp/go-build -gno-record-gcc-switches"

Share the Go related settings you have added/edited
{
    "go.toolsEnvVars": {
        "GOOS": "linux",
        "GOARCH": "386",
    },
}

Describe the bug
In debug mode, if I select the request field as attach and the cwd field is empty, vscode will not respond after clicking the debug button.
Steps to reproduce the behavior:
configuration of debug:
 {
            "name": "dlv-gdb",
            "type": "go",
            "request": "attach",
            "mode": "local",
            //"cwd": "${workspaceFolder}",
            "debugAdapter": "legacy",
            "processId": 1234,
            "backend": "lldb",
            "dlvFlags": [
                "${workspaceRoot}/kernel.elf",
            ],
            "trace": "log",
        },

Duplicate issue #1662: Couldn't attach the process 
Created: 2021-08-04T03:12:21Z
Everything I used is up to date.
Share the Go related settings you have added/edited
{
"name": "Attach to Process",
"type": "go",
"request": "attach",
"mode": "local",
"processId": 2299
},
Describe the bug
I couldn't use the attach debug mode when I use the remote ssh on my server.
I run the app, and get the process id 2299, then I set up the json file.
When I clik the run button, just no reaction.
Screenshots or recordings

Closing comment (2021-08-04T23:46:02Z): Probably a duplicate of #1608.
v0.27.0 will include the fix for the issue. Until then, either try to specify cwd or try a new adapter that doesn't have this issue - (by adding the debugAdapter property: "debugAdapter": "dlv-dap")