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,11 +1883,15 @@ func (s *Session) onThreadsRequest(request *dap.ThreadsRequest) {
} else {
writeLabelsForKeys(s.args.ShowPprofLabels)
}
// File name and line number are communicated via `stackTrace`
// so no need to include them here.
loc := g.UserCurrent()
threads[i].Name = fmt.Sprintf("%s[Go %d%s] %s%s", selected, g.ID, labels.String(), fnName(&loc), thread)
threads[i].Id = int(g.ID)
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()
threads[i].Name = fmt.Sprintf("%s[Go %d%s] %s%s", selected, g.ID, labels.String(), fnName(&loc), thread)
threads[i].Id = int(g.ID)
}
}
}