LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include "runtime.h" | 5 #include "runtime.h" |
6 #include "defs_GOOS_GOARCH.h" | 6 #include "defs_GOOS_GOARCH.h" |
7 #include "os_GOOS.h" | 7 #include "os_GOOS.h" |
8 #include "stack.h" | 8 #include "stack.h" |
9 | 9 |
10 extern SigTab runtime·sigtab[]; | 10 extern SigTab runtime·sigtab[]; |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 macherror(r, "semaphore_signal"); | 406 macherror(r, "semaphore_signal"); |
407 } | 407 } |
408 } | 408 } |
409 | 409 |
410 void | 410 void |
411 runtime·sigpanic(void) | 411 runtime·sigpanic(void) |
412 { | 412 { |
413 //runtime·printf("%d: sigpanic\n", m->id); | 413 //runtime·printf("%d: sigpanic\n", m->id); |
414 switch(g->sig) { | 414 switch(g->sig) { |
415 case SIGBUS: | 415 case SIGBUS: |
| 416 //if(0) |
416 if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000) { | 417 if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000) { |
417 if(g->sigpc == 0) | 418 if(g->sigpc == 0) |
418 runtime·panicstring("call of nil func value"); | 419 runtime·panicstring("call of nil func value"); |
419 runtime·panicstring("invalid memory address or nil point
er dereference"); | 420 runtime·panicstring("invalid memory address or nil point
er dereference"); |
420 } | 421 } |
421 runtime·printf("unexpected fault address %p\n", g->sigcode1); | 422 runtime·printf("unexpected fault address %p\n", g->sigcode1); |
422 runtime·throw("fault"); | 423 runtime·throw("fault"); |
423 case SIGSEGV: | 424 case SIGSEGV: |
| 425 //if(0) |
424 if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR || g->sigcode
0 == SEGV_ACCERR) && g->sigcode1 < 0x1000) { | 426 if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR || g->sigcode
0 == SEGV_ACCERR) && g->sigcode1 < 0x1000) { |
425 if(g->sigpc == 0) | 427 if(g->sigpc == 0) |
426 runtime·panicstring("call of nil func value"); | 428 runtime·panicstring("call of nil func value"); |
427 runtime·panicstring("invalid memory address or nil point
er dereference"); | 429 runtime·panicstring("invalid memory address or nil point
er dereference"); |
428 } | 430 } |
429 runtime·printf("unexpected fault address %p\n", g->sigcode1); | 431 runtime·printf("unexpected fault address %p\n", g->sigcode1); |
430 runtime·throw("fault"); | 432 runtime·throw("fault"); |
431 case SIGFPE: | 433 case SIGFPE: |
432 switch(g->sigcode0) { | 434 switch(g->sigcode0) { |
433 case FPE_INTDIV: | 435 case FPE_INTDIV: |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 runtime·badcallback(void) | 497 runtime·badcallback(void) |
496 { | 498 { |
497 runtime·write(2, badcallback, sizeof badcallback - 1); | 499 runtime·write(2, badcallback, sizeof badcallback - 1); |
498 } | 500 } |
499 | 501 |
500 static int8 badsignal[] = "runtime: signal received on thread not created by Go.
\n"; | 502 static int8 badsignal[] = "runtime: signal received on thread not created by Go.
\n"; |
501 | 503 |
502 // This runs on a foreign stack, without an m or a g. No stack split. | 504 // This runs on a foreign stack, without an m or a g. No stack split. |
503 #pragma textflag 7 | 505 #pragma textflag 7 |
504 void | 506 void |
505 runtime·badsignal(void) | 507 runtime·badsignal(int32 sig) |
506 { | 508 { |
| 509 » if (sig == SIGPROF) { |
| 510 » » return; // Ignore SIGPROFs intended for a non-Go thread. |
| 511 » } |
507 runtime·write(2, badsignal, sizeof badsignal - 1); | 512 runtime·write(2, badsignal, sizeof badsignal - 1); |
508 } | 513 » runtime·exit(1); |
| 514 } |
LEFT | RIGHT |