Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Remote debugging has unverified breakpoints and fails to set breakpoint if local GOPATH partially matches remote GOPATH #1009

Closed
mariusgrigaitis opened this issue May 26, 2017 · 10 comments
Labels

Comments

@mariusgrigaitis
Copy link

mariusgrigaitis commented May 26, 2017

VS Code Version 1.12.2 (1.12.2)
vscode-go v0.6.61

Local GOPATH:
/Users/mgrigaitis/go
Project:
/Users/mgrigaitis/go/src/github.com/org/repo

Remote GOPATH:
/go
Project:
/go/src/github.com/org/repo

workspaceRoot = /Users/mgrigaitis/go/src/github.com/org/repo
in launch.json:

"program": "${workspaceRoot}",
"remotePath":  "/go/src/github.com/org/repo"

In such case remotePath gets set to empty string '' in https://github.com/Microsoft/vscode-go/blob/4beecf1db2aaa18b336be2ee64476b56202fc959/src/debugAdapter/goDebug.ts#L435

After it gets set to empty string, paths mismatches and breakpoints does not get set. It passes this if: https://github.com/Microsoft/vscode-go/blob/4beecf1db2aaa18b336be2ee64476b56202fc959/src/debugAdapter/goDebug.ts#L517

Error on CreateBreakpoint gets thrown.

One known workaround that I found to "overcome" this issue is add trailing "/" to remotePath. Then remotePath does not match local path and remotePath remains intact, trailing / gets removed.

Might be related to #941 #360

Looks like introduced by #742

@mariusgrigaitis mariusgrigaitis changed the title Remote debugging has unverified breakpoints and fails to set breakpoint if local gopath partially matches remote gopath Remote debugging has unverified breakpoints and fails to set breakpoint if local GOPATH partially matches remote GOPATH May 26, 2017
@mariusgrigaitis
Copy link
Author

@f0zi could you look into this since you're familiar with #742?

@f0zi
Copy link
Contributor

f0zi commented May 28, 2017

Can you please try if this fix works for you?

@mariusgrigaitis
Copy link
Author

I do not really think this is proper solution to the problem.

From other parts of code it looks like trailing slashes are removed but here they're added.

And in my case I think that paths shouldn't be touched at all.

@f0zi
Copy link
Contributor

f0zi commented May 29, 2017

@mariusgrigaitis Ack. Please let me know once you tried it.

@mariusgrigaitis
Copy link
Author

mariusgrigaitis commented May 29, 2017

I've tried it. Looks like it works

Config:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Remote",
            "type": "go",
            "request": "launch",
            "mode": "remote",
            "remotePath": "/go/src/github.com/org/repo",
            "port": 2345,
            "host": "127.0.0.1",
            "program": "${workspaceRoot}",
            "env": {},
            "args": [],
            "trace": true,
            "showLog": true
        }
    ]
}

Verbose log:

InitializeRequest
InitializeResponse
InitializeEvent
SetBreakPointsRequest
All cleared
Creating on: /Users/mgrigaitis/go/src/github.com/org/repo/main.go (/go/src/github.com/org/repo/main.go) :40

I've also tried running same against latest master, was able to reproduce Error on CreateBreakpoint.

@f0zi
Copy link
Contributor

f0zi commented May 29, 2017

Thanks, @mariusgrigaitis. I'd like to test another edge-case and I'll do a PR once I'm back home.

@f0zi
Copy link
Contributor

f0zi commented May 30, 2017

It's PR #1014

@ramya-rao-a
Copy link
Contributor

Thanks for reporting @mariusgrigaitis
And @f0zi, Thanks for the quick turnaround.

@roblourens The PR looks good to me, but since you tested @f0zi 's previous related changes, can you take a look as well?

@roblourens
Copy link
Member

Looks ok to me

ramya-rao-a pushed a commit that referenced this issue May 31, 2017
@ramya-rao-a
Copy link
Contributor

The fix is now available in the latest update (0.6.62)

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants