-
Notifications
You must be signed in to change notification settings - Fork 645
Can't set breakpoint in vscode under windows when remote debugging linux-proccess under linux with delve #2931
Comments
Thanks for reporting @deschmih @quoctruong Can you take a look at this? |
@deschmih I think this is the correct behavior. You have to specify both the |
@quoctruong Should we then throw an error if |
@quoctruong & @ramya-rao-a
This results in the following output:
This is what i would expect, because the binary contains the following path
This results in the following output:
As you can see from the output, the path is nearly correct. Only the path separator does not match. |
@deschmih I see. I think forward slash should actually work on Windows too so perhaps we don't have to change the path separator to backslash. @jhendrixMSFT, @ramya-rao-a Do you see any problems with this? |
@deschmih I would recommend that you try using the Go extension from the source to figure out exactly where we are messing up the path separators
|
Sorry for the late response. I have debugged my problem and the following changes solved my problem. https://github.com/microsoft/vscode-go/blob/0.12.0/src/debugAdapter/goDebug.ts#L286-L292 changed to:
https://github.com/microsoft/vscode-go/blob/0.12.0/src/debugAdapter/goDebug.ts#L696-L701 changed to:
I think these changes do not match all usecases of the project, so I have spent more time to make the changes more special for my "windows" usecase. This is the easy one:
https://github.com/microsoft/vscode-go/blob/0.12.0/src/debugAdapter/goDebug.ts#L286-L292
Other ideas are welcome. |
After long time of no action on this issue I have uninstalled vscode. Goland from jetbrain works fine for my purpose. Thanks for your support. |
The past few releases have seen improvements in the parts that @deschmih has outlined above. If anyone is still having problems with debugging, please log a new issue at https://github.com/golang/vscode-go as we are moving! |
What version of Go, VS Code & VS Code Go extension are you using?
go version
to get version of Gocode -v
orcode-insiders -v
to get version of VS Code or VS Code Insidersgo env GOOS GOARCH
to get the operating system and processor arhcitecture detailsShare 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"]
prefixes.Describe the bug
Vscode runs under
windows 10
and i compile a hello.go (simple hello world) for linux withGOOS=linux
.Simple hello world:
The binary is copied to linux and delve is run to make a connection from vscode to remote linux server. My launch-configuration for this connection under vscode is:
Remote connection to delve is successful but setting a break-point fails.
Dlv log on linux server:
The log shows the problem. In the binary, build on windows for linux, the path for hello.go is set to
c:/gopath/src/hello/hello.go
. During the rpc-call forCreateBreakpoint
from vscode to dlv the filec:\\gopath\\src\\hello\\hello.go
is used.Dlv does not find the correct file for set an breakpoint, because of the differently used pathseperators.
objdump hello:
here you can see path "c:/gopath/src/hello/hello.go"
Workaround and test:
go build -gcflags=-trimpath=c: -asmflags=-trimpath=c:
and update the binary on linux server."remotePath": "gopath/src/hello",
in vscode.objdump trimpath hello:
here you can see path "gopath/src/hello/hello.go"
Dlv log on linux server
set breakpoint successful
:The text was updated successfully, but these errors were encountered: