diff options
| author | Keith Randall <khr@golang.org> | 2013-07-16 16:44:24 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2013-07-16 16:44:24 -0700 |
| commit | cc8417610834f5518efe561235f3ed37031f4e59 (patch) | |
| tree | 175e2f306b2ce1f4f5df9d89aad40bc891481b5c /src/pkg/runtime/panic.c | |
| parent | ad477e4e2091f9b26114a176e9e722895e7a52fe (diff) | |
| download | go-cc8417610834f5518efe561235f3ed37031f4e59.tar.xz | |
runtime: print g0 stack if we throw on it and GOTRACEBACK>=2.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/11385045
Diffstat (limited to 'src/pkg/runtime/panic.c')
| -rw-r--r-- | src/pkg/runtime/panic.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/pkg/runtime/panic.c b/src/pkg/runtime/panic.c index 8ec8078d22..8d7d261faf 100644 --- a/src/pkg/runtime/panic.c +++ b/src/pkg/runtime/panic.c @@ -410,16 +410,20 @@ runtime·dopanic(int32 unused) { static bool didothers; bool crash; + int32 t; if(g->sig != 0) runtime·printf("[signal %x code=%p addr=%p pc=%p]\n", g->sig, g->sigcode0, g->sigcode1, g->sigpc); - if(runtime·gotraceback(&crash)){ + if((t = runtime·gotraceback(&crash)) > 0){ if(g != m->g0) { runtime·printf("\n"); runtime·goroutineheader(g); runtime·traceback((uintptr)runtime·getcallerpc(&unused), (uintptr)runtime·getcallersp(&unused), 0, g); + } else if(t >= 2) { + runtime·printf("\nruntime stack:\n"); + runtime·traceback((uintptr)runtime·getcallerpc(&unused), (uintptr)runtime·getcallersp(&unused), 0, g); } if(!didothers) { didothers = true; |
