mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: distinct panic message for call of nil func value
R=golang-dev, gri CC=golang-dev https://golang.org/cl/5531062
This commit is contained in:
parent
57f15a3d03
commit
5032a7dc0c
6 changed files with 44 additions and 11 deletions
|
|
@ -184,13 +184,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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue