diff options
| author | Russ Cox <rsc@golang.org> | 2012-01-10 11:46:57 -0800 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2012-01-10 11:46:57 -0800 |
| commit | 5032a7dc0cb95eefe92714f572b58e5fa1569d6b (patch) | |
| tree | 0dc0760f598f8dd904864106668de57c1340779d /src/pkg/runtime/thread_openbsd.c | |
| parent | 57f15a3d0302c6743150e105958b7f21fddc4058 (diff) | |
| download | go-5032a7dc0cb95eefe92714f572b58e5fa1569d6b.tar.xz | |
runtime: distinct panic message for call of nil func value
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5531062
Diffstat (limited to 'src/pkg/runtime/thread_openbsd.c')
| -rw-r--r-- | src/pkg/runtime/thread_openbsd.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/pkg/runtime/thread_openbsd.c b/src/pkg/runtime/thread_openbsd.c index e1cd5bf2e4..efe03e3711 100644 --- a/src/pkg/runtime/thread_openbsd.c +++ b/src/pkg/runtime/thread_openbsd.c @@ -175,13 +175,19 @@ runtime·sigpanic(void) { switch(g->sig) { case SIGBUS: - if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000) + if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000) { + if(g->sigpc == 0) + runtime·panicstring("call of nil func value"); runtime·panicstring("invalid memory address or nil pointer dereference"); + } runtime·printf("unexpected fault address %p\n", g->sigcode1); runtime·throw("fault"); case SIGSEGV: - if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR || g->sigcode0 == SEGV_ACCERR) && g->sigcode1 < 0x1000) + if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR || g->sigcode0 == SEGV_ACCERR) && g->sigcode1 < 0x1000) { + if(g->sigpc == 0) + runtime·panicstring("call of nil func value"); runtime·panicstring("invalid memory address or nil pointer dereference"); + } runtime·printf("unexpected fault address %p\n", g->sigcode1); runtime·throw("fault"); case SIGFPE: |
