diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2013-11-06 19:49:01 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2013-11-06 19:49:01 +0000 |
commit | f038dae646bac2b31be98ab592c0e5206d2d96f5 (patch) | |
tree | 39530b071991b2326f881b2a30a2d82d6c133fd6 /libgo/runtime/panic.c | |
parent | f20f261304993444741e0f0a14d3147e591bc660 (diff) | |
download | gcc-f038dae646bac2b31be98ab592c0e5206d2d96f5.zip gcc-f038dae646bac2b31be98ab592c0e5206d2d96f5.tar.gz gcc-f038dae646bac2b31be98ab592c0e5206d2d96f5.tar.bz2 |
libgo: Update to October 24 version of master library.
From-SVN: r204466
Diffstat (limited to 'libgo/runtime/panic.c')
-rw-r--r-- | libgo/runtime/panic.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libgo/runtime/panic.c b/libgo/runtime/panic.c index 7d79256..7a8d95b 100644 --- a/libgo/runtime/panic.c +++ b/libgo/runtime/panic.c @@ -38,7 +38,7 @@ runtime_startpanic(void) M *m; m = runtime_m(); - if(runtime_mheap == 0 || runtime_mheap->cachealloc.size == 0) { // very early + if(runtime_mheap.cachealloc.size == 0) { // very early runtime_printf("runtime: panic before malloc heap initialized\n"); m->mallocing = 1; // tell rest of panic not to try to malloc } else if(m->mcache == nil) // can happen if called from signal handler or throw @@ -48,8 +48,13 @@ runtime_startpanic(void) runtime_exit(3); } m->dying = 1; + if(runtime_g() != nil) + runtime_g()->writebuf = nil; runtime_xadd(&runtime_panicking, 1); runtime_lock(&paniclk); + if(runtime_debug.schedtrace > 0 || runtime_debug.scheddetail > 0) + runtime_schedtrace(true); + runtime_freezetheworld(); } void @@ -58,18 +63,22 @@ runtime_dopanic(int32 unused __attribute__ ((unused))) G *g; static bool didothers; bool crash; + int32 t; g = runtime_g(); if(g->sig != 0) runtime_printf("[signal %x code=%p addr=%p]\n", g->sig, (void*)g->sigcode0, (void*)g->sigcode1); - if(runtime_gotraceback(&crash)){ + if((t = runtime_gotraceback(&crash)) > 0){ if(g != runtime_m()->g0) { runtime_printf("\n"); runtime_goroutineheader(g); runtime_traceback(); - runtime_goroutinetrailer(g); + runtime_printcreatedby(g); + } else if(t >= 2 || runtime_m()->throwing > 0) { + runtime_printf("\nruntime stack:\n"); + runtime_traceback(); } if(!didothers) { didothers = true; @@ -113,11 +122,15 @@ runtime_panicstring(const char *s) { Eface err; + if(runtime_m()->mallocing) { + runtime_printf("panic: %s\n", s); + runtime_throw("panic during malloc"); + } if(runtime_m()->gcing) { runtime_printf("panic: %s\n", s); runtime_throw("panic during gc"); } - runtime_newErrorString(runtime_gostringnocopy((const byte*)s), &err); + runtime_newErrorCString(s, &err); runtime_panic(err); } |