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/debugging.md
+41-36Lines changed: 41 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -457,10 +457,49 @@ Sometimes you might like to launch the program for debugging outside of VS Code
457
457
458
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
459
460
-
### Read documentation and [common issues](#common-issues)
460
+
1. Read documentation and [FAQs](#faqs). Also check the [Delve FAQ](https://github.com/go-delve/delve/blob/master/Documentation/faq.md) in case the problem is mentioned there.
461
+
1. Check your `launch.json` configuration. Often error messages appearing in the DEBUG CONSOLE panel reveal issues.
462
+
1. Update Delve (`dlv-dap`) to pick up most recent bug fixes. Follow [the instruction](https://github.com/golang/vscode-go/blob/master/docs/debugging.md#staying-up-to-date).
463
+
1. Check if you can reproduce the issue with `dlv`, the command line tool from the integrated terminal. <!-- TODO(vscode-go): add instructions https://github.com/golang/vscode-go/issues/1931 --> If it's reproducible when using `dlv`, take a look at the [delve's issue tracker](https://github.com/go-delve/delve/issues).
464
+
1. Capture [logs](https://github.com/golang/vscode-go/blob/master/docs/debugging.md#collecting-logs) and inspect them.
465
+
1. Look at the [existing debugging issues](https://github.com/golang/vscode-go/labels/Debug) if similar issues were reported.
466
+
1. If none of these solve your problem, please [open a new issue](#reporting-issues).
461
467
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.
468
+
## FAQs
469
+
470
+
### I need to view large strings. How can I do that if `dlvLoadConfig` with `maxStringLen` is deprecated?
471
+
472
+
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:
473
+
474
+
* Hover over the variable in the source code
475
+
*`Copy as Expression` to query the string via REPL in the DEBUG CONSOLE panel
476
+
*`Copy Value` to clipboard
477
+
478
+
Please [open an issue](https://github.com/golang/vscode-go/issues/new) if this is not sufficient for your use case or if you have any additional feedback.
479
+
480
+
### Why does my debug session have an `invalid command` error when I try to step?
481
+
482
+
When stepping through a program on a particular goroutine, the debugger will make sure that the step is completed, even when interrupted by events on a different goroutine. If a breakpoint is hit on a different goroutine, the debug adapter will stop the program execution to allow you to inspect the state, even though the step request is still active.
483
+
484
+
If you attempt to make another step request you will get an `invalid command` error.
463
485
486
+
<palign="center"><imgsrc="images/invalidCommandExceptionInfo.png"alt="Disable breakpoints from the Breakpoints context menu"width="75%"> </p>
487
+
488
+
Use `Continue` to resume program execution.
489
+
490
+
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.
491
+
492
+
<palign="center"><imgsrc="images/disablebps.png"alt="Disable breakpoints from the Breakpoints context menu"width="75%"> </p>
493
+
494
+
### My program does not stop at breakpoints.
495
+
496
+
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_.
497
+
498
+
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.
499
+
500
+
### Debug sessions started with the "debug test" CodeLens or the test UI does not use my `launch.json` configuration.
501
+
502
+
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.
464
503
## Reporting Issues
465
504
466
505
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).
### I need to view large strings. How can I do that if `dlvLoadConfig` with `maxStringLen` is deprecated?
532
-
533
-
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:
534
-
535
-
* Hover over the variable in the source code
536
-
*`Copy as Expression` to query the string via REPL in the DEBUG CONSOLE panel
537
-
*`Copy Value` to clipboard
538
-
539
-
Please [open an issue](https://github.com/golang/vscode-go/issues/new) if this is not sufficient for your use case or if you have any additional feedback.
540
-
541
-
### Why does my debug session have an `invalid command` error when I try to step?
542
-
543
-
When stepping through a program on a particular goroutine, the debugger will make sure that the step is completed, even when interrupted by events on a different goroutine. If a breakpoint is hit on a different goroutine, the debug adapter will stop the program execution to allow you to inspect the state, even though the step request is still active.
544
-
545
-
If you attempt to make another step request you will get an `invalid command` error.
546
568
547
-
<palign="center"><imgsrc="images/invalidCommandExceptionInfo.png"alt="Disable breakpoints from the Breakpoints context menu"width="75%"> </p>
548
-
549
-
Use `Continue` to resume program execution.
550
-
551
-
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.
552
-
553
-
<palign="center"><imgsrc="images/disablebps.png"alt="Disable breakpoints from the Breakpoints context menu"width="75%"> </p>
554
-
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.
0 commit comments