runtime: honor GOTRACEBACK=crash even if _g_.m.traceback != 0

Change-Id: I6de1ef8f67bde044b8706c01e98400e266e1f8f0
Reviewed-on: https://go-review.googlesource.com/37857
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
Austin Clements 2017-03-07 15:24:02 -05:00
parent c310c688ff
commit caa7dacfd2
1 changed files with 6 additions and 7 deletions

View File

@ -35,15 +35,14 @@ var traceback_env uint32
//go:nosplit
func gotraceback() (level int32, all, crash bool) {
_g_ := getg()
all = _g_.m.throwing > 0
if _g_.m.traceback != 0 {
level = int32(_g_.m.traceback)
return
}
t := atomic.Load(&traceback_cache)
crash = t&tracebackCrash != 0
all = all || t&tracebackAll != 0
level = int32(t >> tracebackShift)
all = _g_.m.throwing > 0 || t&tracebackAll != 0
if _g_.m.traceback != 0 {
level = int32(_g_.m.traceback)
} else {
level = int32(t >> tracebackShift)
}
return
}