From 466f9b8c938727c36a226eafd3333a97c5d51cae Mon Sep 17 00:00:00 2001 From: Alessandro Arzilli Date: Thu, 6 Jan 2022 18:07:26 +0100 Subject: [PATCH] proc: change UserCurrent to exclude internal and runtime/internal (#2853) packages Changes UserCurrent to exclude frames stopped inside the 'internal' and 'runtime/internal' packages of the standard library. Before this change a goroutine blocked accepting or reading from a socket would be reported as having a user current frame of: internal/poll.runtime_pollWait After this change accepting goroutines will be reported with a user current frame of: net.(*netFD).accept and reading goroutines as: net.(*netFD).read --- pkg/proc/variables.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/proc/variables.go b/pkg/proc/variables.go index e8bc08d4..0f794da4 100644 --- a/pkg/proc/variables.go +++ b/pkg/proc/variables.go @@ -497,7 +497,7 @@ func (g *G) UserCurrent() Location { frame := it.Frame() if frame.Call.Fn != nil { name := frame.Call.Fn.Name - if strings.Contains(name, ".") && (!strings.HasPrefix(name, "runtime.") || frame.Call.Fn.exportedRuntime()) { + if strings.Contains(name, ".") && (!strings.HasPrefix(name, "runtime.") || frame.Call.Fn.exportedRuntime()) && !strings.HasPrefix(name, "internal/") && !strings.HasPrefix(name, "runtime/internal") { return frame.Call } }