From: Keith Randall Date: Tue, 28 Apr 2015 21:53:19 +0000 (-0700) Subject: runtime: print stack of G during a signal X-Git-Tag: go1.5beta1~839 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=4b78c9575d3b1190c63b25761dfb86f4d1715c2e;p=gostls13.git runtime: print stack of G during a signal Sequence of operations: - Go code does a systemstack call - during the systemstack call, receive a signal - signal requests a traceback of all goroutines The orignal G is still marked as _Grunning, so the traceback code refuses to print its stack. Fix by allowing traceback of Gs whose caller is on the same M as G is. G can't be modifying its stack if that is the case. Fixes #10546 Change-Id: I2bcea48c0197fbf78ab6fa080027cd80181083ad Reviewed-on: https://go-review.googlesource.com/9435 Reviewed-by: Ian Lance Taylor --- diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go index 512ccd4e94..9f34e37ea4 100644 --- a/src/runtime/traceback.go +++ b/src/runtime/traceback.go @@ -627,7 +627,11 @@ func tracebackothers(me *g) { } print("\n") goroutineheader(gp) - if readgstatus(gp)&^_Gscan == _Grunning { + // Note: gp.m == g.m occurs when tracebackothers is + // called from a signal handler initiated during a + // systemstack call. The original G is still in the + // running state, and we want to print its stack. + if gp.m != g.m && readgstatus(gp)&^_Gscan == _Grunning { print("\tgoroutine running on other thread; stack unavailable\n") printcreatedby(gp) } else {