diff options
author | Austin Clements <austin@google.com> | 2017-12-01 16:13:08 -0500 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2018-05-07 21:38:40 +0000 |
commit | 44286b17c5ca6673648ba57b4a9d49ab8dffedf6 (patch) | |
tree | 19e9be51dced2da66cd7b6fb8cdd67aed045a39d /src/runtime/traceback.go | |
parent | a8a050819bd4693ea7c6fdc1744038f172c2a439 (diff) | |
download | go-44286b17c5ca6673648ba57b4a9d49ab8dffedf6.tar.gz go-44286b17c5ca6673648ba57b4a9d49ab8dffedf6.zip |
runtime: replace system goroutine whitelist with symbol test
Currently isSystemGoroutine has a hard-coded list of known entry
points into system goroutines. This list is annoying to maintain. For
example, it's missing the ensureSigM goroutine.
Replace it with a check that simply looks for any goroutine with
runtime function as its entry point, with a few exceptions. This also
matches the definition recently added to the trace viewer (CL 81315).
Change-Id: Iaed723d4a6e8c2ffb7c0c48fbac1688b00b30f01
Reviewed-on: https://go-review.googlesource.com/81655
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/traceback.go')
-rw-r--r-- | src/runtime/traceback.go | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go index fd649cbbc6..0fd7ef1987 100644 --- a/src/runtime/traceback.go +++ b/src/runtime/traceback.go @@ -990,18 +990,25 @@ func topofstack(f funcInfo, g0 bool) bool { (g0 && f.funcID == funcID_asmcgocall) } -// isSystemGoroutine reports whether the goroutine g must be omitted in -// stack dumps and deadlock detector. +// isSystemGoroutine reports whether the goroutine g must be omitted +// in stack dumps and deadlock detector. This is any goroutine that +// starts at a runtime.* entry point, except for runtime.main and +// sometimes runtime.runfinq. func isSystemGoroutine(gp *g) bool { + // Keep this in sync with cmd/trace/trace.go:isSystemGoroutine. f := findfunc(gp.startpc) if !f.valid() { return false } - return f.funcID == funcID_runfinq && !fingRunning || - f.funcID == funcID_bgsweep || - f.funcID == funcID_forcegchelper || - f.funcID == funcID_timerproc || - f.funcID == funcID_gcBgMarkWorker + if f.funcID == funcID_runtime_main { + return false + } + if f.funcID == funcID_runfinq { + // We include the finalizer goroutine if it's calling + // back into user code. + return !fingRunning + } + return hasprefix(funcname(f), "runtime.") } // SetCgoTraceback records three C functions to use to gather |