golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.89k stars 752 forks source link

Delve's maxGoroutines should be configurable via go.delveConfig #2041

Open shaunco opened 2 years ago

shaunco commented 2 years ago

Is your feature request related to a problem? Please describe. When debugging issues that involve large numbers of goroutines, VSCode will output Too many goroutines, only loaded 1024. It would be very nice to be able to configure this max limit.

Describe the solution you'd like When vscode-go calls Debugger.Goroutines(start, count), either count (maxGoroutines) should be configurable in go.delveConfig or there should be a "Load More..." button at the bottom of the list of 1024 goroutines that will load another 1024.

Describe alternatives you've considered The only alternative is to use dlv on the CLI.

hyangah commented 2 years ago

VS Code team is investigating a better support in UI and the underlying debug protocol https://github.com/microsoft/vscode/issues/116109

@suzmue @polinasok what do you think about adding maxGoroutines to the config list that's configurable dynamically? I am personally skeptical about dumping a large number of goroutines without proper support from VS Code UI and DAP protocol support. (See https://github.com/golang/vscode-go/issues/129 to see what kind of problems users would face) But if VS Code team's support is delayed, we may consider adding this for users to try at their own risk.

polinasok commented 2 years ago

There is no paging support in the underlying protocol. We filed an issue in Nov 2020. That triggered some efforts to investigate alternative protocol & related vscode UI options.

It might not be a bad idea too add maxGoroutines to launch.json and to dlv config (via DEBUG CONSOLE), but with a warning that increasing the limit can freeze the editor (#129).

@shaunco Depending on your needs, it might be more beneficial to try filtering instead of scrolling over pages and pages of goroutines - please try dlv config goroutineFilters via DEBUG CONSOLE with filters referenced here.