]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: print g0 stack if we throw on it and GOTRACEBACK>=2.
authorKeith Randall <khr@golang.org>
Tue, 16 Jul 2013 23:44:24 +0000 (16:44 -0700)
committerKeith Randall <khr@golang.org>
Tue, 16 Jul 2013 23:44:24 +0000 (16:44 -0700)
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/11385045

src/pkg/runtime/panic.c

index 8ec8078d22d414a93998f7efc95d1e92df55c94e..8d7d261fafd7a5d2473b519d84a2a8755f07e1d1 100644 (file)
@@ -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;