Skip to content

Commit 52a73b0

Browse files
authored
service/dap: do not try to stacktrace an unreadable goroutine (#4056)
onThreadRequest should not try to get the location of unreadable goroutines. Fixes #4054
1 parent 03640f2 commit 52a73b0

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

service/dap/server.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,11 +1883,15 @@ func (s *Session) onThreadsRequest(request *dap.ThreadsRequest) {
18831883
} else {
18841884
writeLabelsForKeys(s.args.ShowPprofLabels)
18851885
}
1886-
// File name and line number are communicated via `stackTrace`
1887-
// so no need to include them here.
1888-
loc := g.UserCurrent()
1889-
threads[i].Name = fmt.Sprintf("%s[Go %d%s] %s%s", selected, g.ID, labels.String(), fnName(&loc), thread)
1890-
threads[i].Id = int(g.ID)
1886+
if g.Unreadable != nil {
1887+
threads[i].Name = fmt.Sprintf("%s Unreadable goroutine: %v", selected, g.Unreadable)
1888+
} else {
1889+
// File name and line number are communicated via `stackTrace`
1890+
// so no need to include them here.
1891+
loc := g.UserCurrent()
1892+
threads[i].Name = fmt.Sprintf("%s[Go %d%s] %s%s", selected, g.ID, labels.String(), fnName(&loc), thread)
1893+
threads[i].Id = int(g.ID)
1894+
}
18911895
}
18921896
}
18931897

0 commit comments

Comments
 (0)