mirror of
https://github.com/golang/go
synced 2024-11-18 06:14:46 -07:00
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 <iant@golang.org>
This commit is contained in:
parent
4d1ab2d8d1
commit
4b78c9575d
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user