service/dap: do not try to stacktrace an unreadable goroutine (#4056)

onThreadRequest should not try to get the location of unreadable
goroutines.

Fixes #4054
This commit is contained in:
Alessandro Arzilli 2025-07-17 19:41:09 +02:00 committed by GitHub
parent 03640f2c8d
commit 52a73b0ecf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1883,6 +1883,9 @@ func (s *Session) onThreadsRequest(request *dap.ThreadsRequest) {
} else {
writeLabelsForKeys(s.args.ShowPprofLabels)
}
if g.Unreadable != nil {
threads[i].Name = fmt.Sprintf("%s Unreadable goroutine: %v", selected, g.Unreadable)
} else {
// File name and line number are communicated via `stackTrace`
// so no need to include them here.
loc := g.UserCurrent()
@ -1890,6 +1893,7 @@ func (s *Session) onThreadsRequest(request *dap.ThreadsRequest) {
threads[i].Id = int(g.ID)
}
}
}
response := &dap.ThreadsResponse{
Response: *newResponse(request.Request),