Skip to content

Commit ab38e2a

Browse files
committed
runtime: show m stack during crash on m stack
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
1 parent fa4984d commit ab38e2a

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/pkg/runtime/panic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ runtime·dopanic(int32 unused)
443443
runtime·printf("\n");
444444
runtime·goroutineheader(g);
445445
runtime·traceback((uintptr)runtime·getcallerpc(&unused), (uintptr)runtime·getcallersp(&unused), 0, g);
446-
} else if(t >= 2) {
446+
} else if(t >= 2 || m->throwing > 0) {
447447
runtime·printf("\nruntime stack:\n");
448448
runtime·traceback((uintptr)runtime·getcallerpc(&unused), (uintptr)runtime·getcallersp(&unused), 0, g);
449449
}

src/pkg/runtime/traceback_arm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip,
153153
runtime·printf("\t%S:%d", file, line);
154154
if(frame.pc > f->entry)
155155
runtime·printf(" +%p", (uintptr)(frame.pc - f->entry));
156-
if(m->throwing && gp == m->curg)
156+
if(m->throwing > 0 && gp == m->curg)
157157
runtime·printf(" fp=%p", frame.fp);
158158
runtime·printf("\n");
159159
nprint++;

src/pkg/runtime/traceback_x86.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip,
170170
runtime·printf("\t%S:%d", file, line);
171171
if(frame.pc > f->entry)
172172
runtime·printf(" +%p", (uintptr)(frame.pc - f->entry));
173-
if(m->throwing && gp == m->curg)
173+
if(m->throwing > 0 && gp == m->curg)
174174
runtime·printf(" fp=%p", frame.fp);
175175
runtime·printf("\n");
176176
nprint++;

0 commit comments

Comments
 (0)