Skip to content

Commit 8dd6020

Browse files
committed
docs/debugging: include logpoints, remove stop conditions, revise faqs
They are all fixed in the latest dlv version. Updates #1676 Updates #123 Updates #855 Updates #1840 Change-Id: I6014a1382396865a1921eb6c92e1ccccdea556de Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/366915 Trust: Hyang-Ah Hana Kim <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Polina Sokolova <[email protected]>
1 parent 28a97ef commit 8dd6020

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

docs/debugging.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ You can choose "Start Debugging (F5)" and "Run Without Debugging (^F5)" a.k.a th
8787
* `exec`: debug a precompiled binary. The binary needs to be built with `-gcflags=all="-N -l"` flags to avoid stripping debugging information.
8888
* `auto`: automatically choose between `debug` and `test` depending on the open file.
8989

90-
NOTE: If a `port` attribute is added to any of the launch configurations, it will signal VS Code that instead of launching the debug server internally, it should connect to an external user-specified `dlv dap` server at `host:port` and launch the target there. See ["Remote Debugging"](#remote-debugging) for more details).
90+
⚠️ If a `port` attribute is added to any of the launch configurations, it will signal VS Code that instead of launching the debug server internally, it should connect to an external user-specified `dlv dap` server at `host:port` and launch the target there. See ["Remote Debugging"](#remote-debugging) for more details).
91+
92+
The `program` attribute must point to the absolute path to the package or binary to debug in the remote host’s file system even when `substitutePath` is specified.
9193

9294
### Attach
9395

@@ -167,7 +169,7 @@ See [VS Code’s Debug Documentation on Breakpoints](https://code.visualstudio.c
167169
<img src="images/function-breakpoint.gif" alt="Function breakpoint" width="75%">
168170
</p>
169171

170-
* Logpoint (WIP)
172+
* **Logpoints**: a [logpoint](https://code.visualstudio.com/docs/editor/debugging#_logpoints) is a variant of breakpoint that does not 'break', but instead logs a message to Debug Console and continues execution. Expressions within `{}` are interpolated. For the list of acceptable expressions and syntax, see [Delve's documentation](https://github.com/go-delve/delve/blob/master/Documentation/cli/expr.md#expressions).
171173

172174
### Data Inspection
173175

@@ -451,6 +453,14 @@ Sometimes you might like to launch the program for debugging outside of VS Code
451453
* Compile and run the target program from the external terminal and use [the "attach" configuration](#attach).
452454
* Run the debug server from the external terminal with `--listen=:<port>` and have VS Code connect to it using `port` in your launch configuration (see ["Remote Debugging"](#remote-debugging) for more details)
453455

456+
## Troubleshooting
457+
458+
The suggestions below are intended to help you troubleshoot any problems you encounter. If you are unable to resolve the issue, please take a look at the [current known debugging issues](https://github.com/golang/vscode-go/issues?q=is%3Aissue+is%3Aopen+label%3ADebug) or [report a new issue](#reporting-issues).
459+
460+
### Read documentation and [common issues](#common-issues)
461+
462+
Start by taking a quick glance at the [FAQs](#faqs) described below. You can also check the [Delve FAQ](https://github.com/go-delve/delve/blob/master/Documentation/faq.md) in case the problem is mentioned there.
463+
454464
## Reporting Issues
455465

456466
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 problems 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).
@@ -518,10 +528,6 @@ $ dlv-dap dap --listen=:12345 --log --log-output=dap
518528

519529
## FAQs
520530

521-
### Why does my debug session stop when I set breakpoints?
522-
523-
To support being able to set breakpoints while the program is running, the debug adapter needs to stop the program. Due to the extra synchronization required to correctly resume the program, the debug adapter currently sends a stopped event. This means that if you are editing breakpoints while the program is running, you will need to hit continue to continue your debug session. We plan to change the behavior of the debug adapter for more seamless editing of breakpoints. You can track the progress [here](https://github.com/golang/vscode-go/issues/1676).
524-
525531
### I need to view large strings. How can I do that if `dlvLoadConfig` with `maxStringLen` is deprecated?
526532

527533
The legacy adapter used `dlvLoadConfig` as one-time session-wide setting to override dlv's conservative default variable loading limits, intended to protect tool's performance. The new debug adapter is taking a different approach with on-demand loading of composite data and updated string limits, relaxed when interacting with individual strings. In particular, if the new default limit of 512, applied to all string values in the variables pane, is not sufficient, you can take advantage of a larger limit of 4096 with one of the following:
@@ -540,13 +546,21 @@ If you attempt to make another step request you will get an `invalid command` er
540546

541547
<p align="center"><img src="images/invalidCommandExceptionInfo.png" alt="Disable breakpoints from the Breakpoints context menu" width="75%"> </p>
542548

543-
544549
Use `Continue` to resume program execution.
545550

546551
If you do not want the step request to be interrupted, you can disable all breakpoints from VS Code from the context menu in the `Breakpoints` view.
547552

548553
<p align="center"><img src="images/disablebps.png" alt="Disable breakpoints from the Breakpoints context menu" width="75%"> </p>
549554

555+
### My program does not stop at breakpoints.
556+
557+
Check the "BREAKPOINTS" section in the debug view and see if the breakpoints are [greyed out](https://code.visualstudio.com/docs/editor/debugging#_breakpoints) when your debug session is active. Setting `stopOnEntry` is a great way to pause execution at the start to _verify_ breakpoints are set correctly. Or [enable logging](#collecting-logs) and see if `setBreakpoints` requests succeeded with all the breakpoints _verified_.
558+
559+
This problem often occurs when the source location used in compiling the debugged program and the workspace directory VS Code uses are different. Common culprits are remote debugging where the program is built in the remote location, use of symbolic links, or use of `-trimpath` build flags. In this case, configure the `substitutePath` attribute in your launch configuration.
560+
561+
### Debug sessions started with the "debug test" CodeLens or the test UI does not use my `launch.json` configuration.
562+
563+
The "debug test" CodeLens and the [test UI](https://github.com/golang/vscode-go/blob/master/docs/features.md#test-and-benchmark) do not use the `launch.json` configuration ([Issue 855](https://github.com/golang/vscode-go/issues/855)). As a workaround, use the `go.delveConfig` setting and the `go.testFlags` setting. Please note that these all apply to all debug sessions unless overwritten by a specific `launch.json` configuration.
550564

551565
[Delve]: https://github.com/go-delve/delve
552566
[VS Code variables]: https://code.visualstudio.com/docs/editor/variables-reference

0 commit comments

Comments
 (0)