]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: show m stack during crash on m stack
authorRuss Cox <rsc@golang.org>
Wed, 11 Sep 2013 16:00:37 +0000 (12:00 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 11 Sep 2013 16:00:37 +0000 (12:00 -0400)
The various throwing > 0 finish a change started
in a previous CL, which sets throwing = -1 to mean
"don't show the internals". That gets set during the
"all goroutines are asleep - deadlock!" crash, and it
should also be set during any other expected crash
that does not indicate a problem within the runtime.

Most runtime.throw do indicate a problem within the
runtime, however, so we should be able to enumerate
the ones that should be silent. The goroutine sleeping
deadlock is the only one I can think of.

Update #5139

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13662043

src/pkg/runtime/panic.c
src/pkg/runtime/traceback_arm.c
src/pkg/runtime/traceback_x86.c

index 4fbbed107130fb5994efa23f7ea5aa8df3e0049e..c14d52016cea4acad8c07b0abaf0aaf1a1db5b4c 100644 (file)
@@ -443,7 +443,7 @@ runtime·dopanic(int32 unused)
                        runtime·printf("\n");
                        runtime·goroutineheader(g);
                        runtime·traceback((uintptr)runtime·getcallerpc(&unused), (uintptr)runtime·getcallersp(&unused), 0, g);
-               } else if(t >= 2) {
+               } else if(t >= 2 || m->throwing > 0) {
                        runtime·printf("\nruntime stack:\n");
                        runtime·traceback((uintptr)runtime·getcallerpc(&unused), (uintptr)runtime·getcallersp(&unused), 0, g);
                }
index 74725ba4ca6c7898e1da503586166875e0c658e6..02586f036bba6dad9d60a27fab63b8b14ea5a510 100644 (file)
@@ -153,7 +153,7 @@ runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip,
                                runtime·printf("\t%S:%d", file, line);
                                if(frame.pc > f->entry)
                                        runtime·printf(" +%p", (uintptr)(frame.pc - f->entry));
-                               if(m->throwing && gp == m->curg)
+                               if(m->throwing > 0 && gp == m->curg)
                                        runtime·printf(" fp=%p", frame.fp);
                                runtime·printf("\n");
                                nprint++;
index 78f8bd5aad26e87a7cbc6617fce5e1902a50bb28..a18bb9a6a258201e39e40466b19e9ad7ed98cca5 100644 (file)
@@ -170,7 +170,7 @@ runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip,
                                runtime·printf("\t%S:%d", file, line);
                                if(frame.pc > f->entry)
                                        runtime·printf(" +%p", (uintptr)(frame.pc - f->entry));
-                               if(m->throwing && gp == m->curg)
+                               if(m->throwing > 0 && gp == m->curg)
                                        runtime·printf(" fp=%p", frame.fp);
                                runtime·printf("\n");
                                nprint++;