Skip to content

Commit d34fee8

Browse files
committed
docs/debugging.md: update remote debugging documentation
Fix the remote debugging documentation to have the current configuration settings. Fixes #164 Updates #45 Change-Id: I4df7b080d2e26275218ccbdf3d79d3b82c44bd8c Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/253741 Trust: Suzy Mueller <[email protected]> Reviewed-by: Polina Sokolova <[email protected]> Reviewed-by: Quoc Truong <[email protected]>
1 parent a5e0287 commit d34fee8

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

docs/debugging.md

+7-9
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,14 @@ type | Always leave this set to `"go"`. VS Code uses this setting to deter
103103
request | One of `launch` or `attach`. Use `attach` when you want to attach to a running process.
104104
mode | For `launch` requests, one of `auto`, `debug`, `remote`, `test`, or `exec`. For `attach` requests, use `local` or `remote`.
105105
program | In `test` or `debug` mode, this refers to the absolute path to the package or file to debug. In `exec` mode, this is the existing binary file to debug. Not applicable to `attach` requests.
106-
env | Environment variables to use when debugging. Use the format: `{ "NAME": "VALUE" }`.
106+
env | Environment variables to use when debugging. Use the format: `{ "NAME": "VALUE" }`. Not applicable to `attach` requests.
107107
envFile | Absolute path to a file containing environment variable definitions. The environment variables passed in via the `env` property override the ones in this file.
108108
args | Array of command-line arguments to pass to the program being debugged.
109109
showLog | If `true`, Delve logs will be printed in the Debug Console panel.
110110
logOutput | Comma-separated list of Delve components (`debugger`, `gdbwire`, `lldbout`, `debuglineerr`, `rpc`) that should produce debug output when `showLog` is `true`.
111111
buildFlags | Build flags to pass to the Go compiler.
112-
remotePath | If remote debugging (`mode`: `remote`), this should be the absolute path to the file being debugged on the remote machine. See the section on [Remote Debugging](#remote-debugging) for further details. [golang/vscode-go#45](https://github.com/golang/vscode-go/issues/45) is also relevant.
112+
remotePath | If remote debugging (`mode`: `remote`), this should be the absolute path to the package being debugged on the remote machine. See the section on [Remote Debugging](#remote-debugging) for further details. [golang/vscode-go#45](https://github.com/golang/vscode-go/issues/45) is also relevant.
113+
cwd | The working directory to be used in running the program. If remote debugging (`mode`: `remote`), this should be the absolute path to the working directory being debugged on the local machine. See the section on [Remote Debugging](#remote-debugging) for further details. [golang/vscode-go#45](https://github.com/golang/vscode-go/issues/45) is also relevant.
113114
processId | This is the process ID of the executable you want to debug. Applicable only when using the `attach` request in `local` mode.
114115

115116
### Specifying [build tags](https://golang.org/pkg/go/build/#hdr-Build_Constraints)
@@ -266,21 +267,18 @@ Then, create a remote debug configuration in your `launch.json`.
266267
{
267268
"name": "Launch remote",
268269
"type": "go",
269-
"request": "launch",
270+
"request": "attach",
270271
"mode": "remote",
271-
"remotePath": "/absolute/path/file/on/remote/machine",
272+
"remotePath": "/absolute/path/dir/on/remote/machine",
272273
"port": 2345,
273274
"host": "127.0.0.1",
274-
"program": "/absolute/path/file/on/local/machine",
275-
"env": {}
275+
"cwd": "/absolute/path/dir/on/local/machine",
276276
}
277277
```
278278

279279
In the example, the VS Code debugger will run on the same machine as the headless `dlv` server. Make sure to update the `port` and `host` settings to point to your remote machine.
280280

281-
`remotePath` should point to the absolute path of the file being debugged in the remote machine. See [golang/vscode-go#126](https://github.com/golang/vscode-go/issues/126) for updates regarding `remotePath`.
282-
283-
`program` should point to the absolute path of the file on your local machine. This should be the counterpart of the file in `remotePath`.
281+
`remotePath` should point to the absolute path of the program being debugged in the remote machine. `cwd` should point to the absolute path of the working directory of the program being debugged on your local machine. This should be the counterpart of the folder in `remotePath`. See [golang/vscode-go#45](https://github.com/golang/vscode-go/issues/45) for updates regarding `remotePath` and `cwd`.
284282

285283
When you run the `Launch remote` target, VS Code will send debugging commands to the `dlv` server you started, instead of launching it's own `dlv` instance against your program.
286284

0 commit comments

Comments
 (0)