You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/dlv-dap.md
+42-23Lines changed: 42 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,25 +2,22 @@
2
2
3
3
[`Delve`'s native DAP implementation](https://github.com/go-delve/delve/tree/master/service/dap) is now available to be used to debug Go programs.
4
4
5
-
This debug adapter runs in a separate `go` process, which is spawned by VS Code when you debug Go code. Since `dlv dap` is under active development, we need the Delve built at master to get all recent updates. The Go extension currently maintains this unstable version of Delve separately from the stable version (`dlv`), and installs it as `dlv-dap`.
5
+
_________________
6
+
**🔥 This new adapter is still in active development, so to take advantage of the most recent features and bug fixes, you need to use Delve built from the dev branch. When the extension asks to install/update `dlv-dap`, please follow the instruction and rebuild the tool.**
7
+
_________________
6
8
7
-
Please see the [Debug Adapter Protocol (DAP)](https://microsoft.github.io/debug-adapter-protocol/) to understand how the Debug Adapter acts as an intermediary between VS Code and the debugger ([Delve](https://github.com/go-delve/delve)).
9
+
The Go extension currently maintains this development version of Delve separately from the stable version of `dlv`. This version is installed with the name `dlv-dap`. Please follow the instruction in [Getting Started](#getting-started) to configure the extension and install `dlv-dap`.
8
10
9
-
Follow along with [golang/vscode-go#23](https://github.com/golang/vscode-go/issues/23) and the [project dashboard](https://github.com/golang/vscode-go/projects/3) for updates on the implementation.
10
-
11
-
## Overview
11
+
This new debug adapter runs in a separate `go` process, which is spawned by VS Code when you debug Go code.
12
+
Please see the [Debug Adapter Protocol (DAP)](https://microsoft.github.io/debug-adapter-protocol/) to learn about how the Debug Adapter acts as an intermediary between VS Code and the debugger ([Delve](https://github.com/go-delve/delve)).
12
13
13
-
*[How to use dlv dap](#how-to-use-dlv-dap)
14
-
*[Features & Caveats](#features-and-caveats)
15
-
*[Reporting issues](#reporting-issues)
16
-
*[How to contribute](#developing)
17
14
18
-
## How to use dlv dap
15
+
## Getting Started
19
16
20
-
You can choose which debug adapter to use with the `"debugAdapter"` field in [your `launch.json` configuration](https://github.com/golang/vscode-go/blob/master/docs/debugging.md#snippets). Most settings will continue to work with in `"dlv-dap" debugAdapter` mode except [a few caveats](#features-and-caveats).
17
+
You can choose which debug adapter to use with the `"debugAdapter"` field in [your `launch.json` configuration](https://github.com/golang/vscode-go/blob/master/docs/debugging.md#snippets). Most settings will continue to work with in this new `"dlv-dap"` mode except [a few caveats](#features-and-caveats).
21
18
If you do not already have a `launch.json`, select `create a launch.json file` from the debug pane and choose an initial Go debug configuration.
22
19
23
-
<divstyle="text-align: center;"><imgsrc="images/createlaunchjson.png"alt="The debug pane with the option to create launch.json"> </div>
20
+
<divstyle="text-align: center;"><imgsrc="images/createlaunchjson.png"width=200alt="The debug pane with the option to create launch.json"> </div>
24
21
25
22
In your launch configuration, set the `"debugAdapter"` field to be `"dlv-dap"`. For example, a launch configuration for a file would look like:
26
23
@@ -30,13 +27,19 @@ In your launch configuration, set the `"debugAdapter"` field to be `"dlv-dap"`.
30
27
"type":"go",
31
28
"request":"launch",
32
29
"mode":"auto",
33
-
"program":"${file}",
30
+
"program":"${fileDirname}",
34
31
"debugAdapter":"dlv-dap"
35
32
}
36
33
```
37
34
38
35
To switch back to the legacy adapter, set `"debugAdapter"` to `"legacy"`.
39
36
37
+
When you start debugging using the configuration for the first time, the extension will ask you to install `dlv-dap`.
Once `dlv-dap` is installed, the extension will prompt you for update whenever installing a newer version is necessary (usually after the Go extension update).
42
+
40
43
### Updating dlv dap
41
44
The easiest way is to use the `"Go: Install/Update Tools"` command from the command palette (⇧+⌘+P or Ctrl+Shift+P). The command will show `dlv-dap` in the tool list. Select it, and the extension will build the tool at master.
<!-- TODO: update the debugging section of features.md using dlv-dap mode -->
55
+
56
+
🎉 The new debug adapter offers many improvements and fixes bugs that existed in the old adapter. [Here](https://github.com/golang/vscode-go/issues?q=is%3Aissue+label%3Afixedindlvdaponly) is a partial list of enhancement/fixes available only in the new adapter.
57
+
58
+
* User-friendly inlined presentation of variables of all complex types (map, struct, pointer, array, slice, ...)
59
+
* Fixed handling of maps with compound keys
60
+
* Improved CALL STACK presentation
61
+
* Fixed automated "Add to Watch" / "Copy as Expression" expressions.
62
+
* Support to switch goroutines while stepping.
63
+
* Robust `call` evaluation.
64
+
* Good test coverage.
51
65
52
-
Dlv DAP implementation offers the following advantages:
<!-- TODO(polinasok,suzmue): add more unique features -->
55
66
56
-
The following features are still under development.
67
+
Most of all, the new adapter is written in Go and integrated in `dlv`. That will make it easier for the Go community to contribute. </br>
68
+
Because it is native, we hope for improvement in speed and reliability.
57
69
58
-
* Stop/pause/restart while the debugged program is running does not work.
70
+
⚒️ The following features are still under development.
71
+
72
+
* Stop/pause/restart while the debugged program is running does not work yet.
59
73
* Cannot be used with `debug test` codelens.
60
74
* Support for `"dlvFlags"` attributes in launch configuration is not available.
61
75
*`dlvLoadConfig` to configure max string/bytes length in [`"go.delveConfig"`](https://github.com/golang/vscode-go/blob/master/docs/debugging.md#configuration) does not work.
62
76
*[Remote debugging](https://github.com/golang/vscode-go/blob/master/docs/debugging.md#remote-debugging) is not supported.
63
77
78
+
Follow along with [golang/vscode-go#23](https://github.com/golang/vscode-go/issues/23) and the [project dashboard](https://github.com/golang/vscode-go/projects/3) for updates on the implementation.
79
+
64
80
## Reporting issues
65
81
66
-
The VS Code Go maintainers are reachable via the issue tracker and the #vscode-dev channel in the Gophers Slack. Please reach out on Slack with questions, suggestions, or ideas. If you have trouble getting started on an issue, we'd be happy to give pointers and advice.
82
+
The VS Code Go maintainers are reachable via the issue tracker and the #vscode-dev channel in the Gophers Slack. </br>
83
+
Please reach out on Slack with questions, suggestions, or ideas. If you have trouble getting started on an issue, we'd be happy to give pointers and advice.
84
+
85
+
When you are having issues in `dlv-dap` mode, first check if the problems are reproducible after updating `dlv-dap`. It's possible that the issues are already fixed. Follow the instruction for [updating dlv-dap](#updating-dlv-dap)) and [updating extension](https://code.visualstudio.com/docs/editor/extension-gallery#_extension-autoupdate).
67
86
68
87
Please report issues in [our issue tracker](https://github.com/golang/vscode-go/issues) with the following information.
69
88
70
89
*`go version`
71
90
*`go version -m dlv-dap`
72
-
* Instruction to reproduce the issue (code snippets, `launch.json`, screenshot)
91
+
* VS Code and VS Code Go version.
92
+
* Instruction to reproduce the issue (code snippets, your `launch.json`, screenshot)
73
93
74
94
## Developing
75
95
@@ -91,11 +111,10 @@ Set `logOutput` and `showLog` attributes in `launch.json` to enable logging and
0 commit comments