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

remotePath of '/' when debugging remote linux container translates breakpoint paths to windows local paths #2119

Closed
FrankSzendzielarz opened this issue Nov 13, 2018 · 3 comments
Labels

Comments

@FrankSzendzielarz
Copy link

FrankSzendzielarz commented Nov 13, 2018

On Windows 10 , building a Linux docker container, add the files to a subfolder such as x/y/z

run the container with security-options="seccomp=unconfined' (and an entrypoint running dlv as follows:

dlv test --headless --listen=:2345 --log=true --api-version=1 )

In VSCODE, make sure the files you are debugging are also in a local c:<workspace>\x\y\z (otherwise breakpoint matching does not work ever anyway).

In launch.json set the remotePath to "/" (see below)

With verbose logging, note that the breakpoint cannot be set or verified, because it translates the path to C:<workspace>\x\y\z (windows file separator)

Repeat the process adding the source files instead to a subfolder eg /src/x/y/z

Set remote path to /src/

Breakpoints now work because VSCode translates the breakpoint path to Linux file separated absolute path.

{

        "name": "Remote debug in Docker",
        "type": "go",
        "request": "launch",
        "mode": "remote",
        "program": "${workspaceFolder}",
        "env": {},
        "args": [],

        "remotePath": "/",

        "port": 2345, // Port 

        "host": "172.17.0.2" ,
        "showLog": true,
        "trace": "verbose"

    }
@ramya-rao-a
Copy link
Contributor

Repeat the process adding the source files instead to a subfolder eg /src/x/y/z

You do this in the container or on Windows?

@FrankSzendzielarz
Copy link
Author

FrankSzendzielarz commented Nov 21, 2018 via email

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Sep 27, 2019

This has been fixed in the latest update to the Go extension (0.11.7)
Thanks @quoctruong for the fix (PR 2794) & thanks @FrankSzendzielarz for logging the issue.

Happy Coding!

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 11, 2019
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

2 participants