diff --git a/service/dap/server.go b/service/dap/server.go index f122aa2113af447354c4fd0de5e25aca69aa1f08..34c8a5790a95b36f1fe48236d43fc3388be84d52 100644 --- a/service/dap/server.go +++ b/service/dap/server.go @@ -191,6 +191,8 @@ const ( // what is presented. A common use case of a call injection is to // stringify complex data conveniently. maxStringLenInCallRetVars = 1 << 10 // 1024 + // Max number of goroutines that we will return. + maxGoroutines = 1 << 10 ) // NewServer creates a new DAP Server. It takes an opened Listener @@ -1456,7 +1458,7 @@ func (s *Server) onThreadsRequest(request *dap.ThreadsRequest) { return } - gs, _, err := s.debugger.Goroutines(0, 0) + gs, next, err := s.debugger.Goroutines(0, maxGoroutines) if err != nil { switch err.(type) { case proc.ErrProcessExited: @@ -1469,6 +1471,10 @@ func (s *Server) onThreadsRequest(request *dap.ThreadsRequest) { return } + if next >= 0 { + s.logToConsole(fmt.Sprintf("too many goroutines, only loaded %d", len(gs))) + } + threads := make([]dap.Thread, len(gs)) if len(threads) == 0 { // Depending on the debug session stage, goroutines information