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
|
|
@ -382,13 +382,19 @@ runtime·sigpanic(void)
|
||||||
{
|
{
|
||||||
switch(g->sig) {
|
switch(g->sig) {
|
||||||
case SIGBUS:
|
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·panicstring("invalid memory address or nil pointer dereference");
|
||||||
|
}
|
||||||
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
||||||
runtime·throw("fault");
|
runtime·throw("fault");
|
||||||
case SIGSEGV:
|
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·panicstring("invalid memory address or nil pointer dereference");
|
||||||
|
}
|
||||||
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
||||||
runtime·throw("fault");
|
runtime·throw("fault");
|
||||||
case SIGFPE:
|
case SIGFPE:
|
||||||
|
|
|
||||||
|
|
@ -128,13 +128,19 @@ runtime·sigpanic(void)
|
||||||
{
|
{
|
||||||
switch(g->sig) {
|
switch(g->sig) {
|
||||||
case SIGBUS:
|
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·panicstring("invalid memory address or nil pointer dereference");
|
||||||
|
}
|
||||||
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
||||||
runtime·throw("fault");
|
runtime·throw("fault");
|
||||||
case SIGSEGV:
|
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·panicstring("invalid memory address or nil pointer dereference");
|
||||||
|
}
|
||||||
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
||||||
runtime·throw("fault");
|
runtime·throw("fault");
|
||||||
case SIGFPE:
|
case SIGFPE:
|
||||||
|
|
|
||||||
|
|
@ -184,13 +184,19 @@ runtime·sigpanic(void)
|
||||||
{
|
{
|
||||||
switch(g->sig) {
|
switch(g->sig) {
|
||||||
case SIGBUS:
|
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·panicstring("invalid memory address or nil pointer dereference");
|
||||||
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
||||||
runtime·throw("fault");
|
runtime·throw("fault");
|
||||||
case SIGSEGV:
|
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·panicstring("invalid memory address or nil pointer dereference");
|
||||||
|
}
|
||||||
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
||||||
runtime·throw("fault");
|
runtime·throw("fault");
|
||||||
case SIGFPE:
|
case SIGFPE:
|
||||||
|
|
|
||||||
|
|
@ -175,13 +175,19 @@ runtime·sigpanic(void)
|
||||||
{
|
{
|
||||||
switch(g->sig) {
|
switch(g->sig) {
|
||||||
case SIGBUS:
|
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·panicstring("invalid memory address or nil pointer dereference");
|
||||||
|
}
|
||||||
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
||||||
runtime·throw("fault");
|
runtime·throw("fault");
|
||||||
case SIGSEGV:
|
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·panicstring("invalid memory address or nil pointer dereference");
|
||||||
|
}
|
||||||
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
||||||
runtime·throw("fault");
|
runtime·throw("fault");
|
||||||
case SIGFPE:
|
case SIGFPE:
|
||||||
|
|
|
||||||
|
|
@ -175,13 +175,19 @@ runtime·sigpanic(void)
|
||||||
{
|
{
|
||||||
switch(g->sig) {
|
switch(g->sig) {
|
||||||
case SIGBUS:
|
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·panicstring("invalid memory address or nil pointer dereference");
|
||||||
|
}
|
||||||
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
||||||
runtime·throw("fault");
|
runtime·throw("fault");
|
||||||
case SIGSEGV:
|
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·panicstring("invalid memory address or nil pointer dereference");
|
||||||
|
}
|
||||||
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
||||||
runtime·throw("fault");
|
runtime·throw("fault");
|
||||||
case SIGFPE:
|
case SIGFPE:
|
||||||
|
|
|
||||||
|
|
@ -270,8 +270,11 @@ runtime·sigpanic(void)
|
||||||
{
|
{
|
||||||
switch(g->sig) {
|
switch(g->sig) {
|
||||||
case EXCEPTION_ACCESS_VIOLATION:
|
case EXCEPTION_ACCESS_VIOLATION:
|
||||||
if(g->sigcode1 < 0x1000)
|
if(g->sigcode1 < 0x1000) {
|
||||||
|
if(g->sigpc == 0)
|
||||||
|
runtime·panicstring("call of nil func value");
|
||||||
runtime·panicstring("invalid memory address or nil pointer dereference");
|
runtime·panicstring("invalid memory address or nil pointer dereference");
|
||||||
|
}
|
||||||
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
runtime·printf("unexpected fault address %p\n", g->sigcode1);
|
||||||
runtime·throw("fault");
|
runtime·throw("fault");
|
||||||
case EXCEPTION_INT_DIVIDE_BY_ZERO:
|
case EXCEPTION_INT_DIVIDE_BY_ZERO:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue