runtime: introduce GOTRACEBACK=single, now the default

Abandon (but still support) the old numbering system.

GOTRACEBACK=none is old 0
GOTRACEBACK=single is the new behavior
GOTRACEBACK=all is old 1
GOTRACEBACK=system is old 2
GOTRACEBACK=crash is unchanged

See doc comment change in runtime1.go for details.

Filed #13107 to decide whether to change default back to GOTRACEBACK=all for Go 1.6 release.
If you run into programs where printing only the current goroutine omits
needed information, please add details in a comment on that issue.

Fixes #12366.

Change-Id: I82ca8b99b5d86dceb3f7102d38d2659d45dbe0db
Reviewed-on: https://go-review.googlesource.com/16512
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Russ Cox 2015-10-30 11:03:02 -04:00
parent 845878a213
commit bf1de1b141
11 changed files with 78 additions and 55 deletions

View file

@ -605,18 +605,21 @@ func dopanic_m(gp *g, pc, sp uintptr) {
print("[signal ", hex(gp.sig), " code=", hex(gp.sigcode0), " addr=", hex(gp.sigcode1), " pc=", hex(gp.sigpc), "]\n")
}
var docrash bool
level, all, docrash := gotraceback()
_g_ := getg()
if t := gotraceback(&docrash); t > 0 {
if level > 0 {
if gp != gp.m.curg {
all = true
}
if gp != gp.m.g0 {
print("\n")
goroutineheader(gp)
traceback(pc, sp, 0, gp)
} else if t >= 2 || _g_.m.throwing > 0 {
} else if level >= 2 || _g_.m.throwing > 0 {
print("\nruntime stack:\n")
traceback(pc, sp, 0, gp)
}
if !didothers {
if !didothers && all {
didothers = true
tracebackothers(gp)
}