diff options
| author | Russ Cox <rsc@golang.org> | 2013-03-15 01:11:03 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2013-03-15 01:11:03 -0400 |
| commit | 5146a93e72e870b06150c5419e1b83056ecc697b (patch) | |
| tree | 8a482053149a8dc5814a9136966a3dd0584f7ef9 /src/pkg/runtime/panic.c | |
| parent | f6a952599e2e9d75b50d1b1252397325111b1a87 (diff) | |
| download | go-5146a93e72e870b06150c5419e1b83056ecc697b.tar.xz | |
runtime: accept GOTRACEBACK=crash to mean 'crash after panic'
This provides a way to generate core dumps when people need them.
The settings are:
GOTRACEBACK=0 no traceback on panic, just exit
GOTRACEBACK=1 default - traceback on panic, then exit
GOTRACEBACK=2 traceback including runtime frames on panic, then exit
GOTRACEBACK=crash traceback including runtime frames on panic, then crash
Fixes #3257.
R=golang-dev, devon.odell, r, daniel.morsing, ality
CC=golang-dev
https://golang.org/cl/7666044
Diffstat (limited to 'src/pkg/runtime/panic.c')
| -rw-r--r-- | src/pkg/runtime/panic.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/pkg/runtime/panic.c b/src/pkg/runtime/panic.c index fbcf6a572d..d0cf3ad6f9 100644 --- a/src/pkg/runtime/panic.c +++ b/src/pkg/runtime/panic.c @@ -402,12 +402,13 @@ void runtime·dopanic(int32 unused) { static bool didothers; + bool crash; 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()){ + if(runtime·gotraceback(&crash)){ if(g != m->g0) { runtime·printf("\n"); runtime·goroutineheader(g); @@ -428,6 +429,9 @@ runtime·dopanic(int32 unused) runtime·lock(&deadlock); runtime·lock(&deadlock); } + + if(crash) + runtime·crash(); runtime·exit(2); } |
