1
0
mirror of https://github.com/golang/go synced 2024-11-18 10:54:40 -07:00

runtime: print g0 stack if we throw on it and GOTRACEBACK>=2.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/11385045
This commit is contained in:
Keith Randall 2013-07-16 16:44:24 -07:00
parent ad477e4e20
commit cc84176108

View 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;