44 |
|
static bool sigsegv_ignore_fault = false; |
45 |
|
|
46 |
|
// User's SIGSEGV handler |
47 |
< |
static sigsegv_handler_t sigsegv_user_handler = 0; |
47 |
> |
static sigsegv_fault_handler_t sigsegv_fault_handler = 0; |
48 |
|
|
49 |
|
// Function called to dump state if we can't handle the fault |
50 |
< |
static sigsegv_handler_t sigsegv_dump_state = 0; |
50 |
> |
static sigsegv_state_dumper_t sigsegv_state_dumper = 0; |
51 |
|
|
52 |
|
// Actual SIGSEGV handler installer |
53 |
|
static bool sigsegv_do_install_handler(int sig); |
488 |
|
bool fault_recovered = false; |
489 |
|
|
490 |
|
// Call user's handler and reinstall the global handler, if required |
491 |
< |
if (sigsegv_user_handler(fault_address, fault_instruction)) { |
491 |
> |
if (sigsegv_fault_handler(fault_address, fault_instruction)) { |
492 |
|
#if (defined(HAVE_SIGACTION) ? defined(SIGACTION_NEED_REINSTALL) : defined(SIGNAL_NEED_REINSTALL)) |
493 |
|
sigsegv_do_install_handler(sig); |
494 |
|
#endif |
509 |
|
#undef FAULT_HANDLER |
510 |
|
|
511 |
|
// We can't do anything with the fault_address, dump state? |
512 |
< |
if (sigsegv_dump_state != 0) |
513 |
< |
sigsegv_dump_state(fault_address, fault_instruction); |
512 |
> |
if (sigsegv_state_dumper != 0) |
513 |
> |
sigsegv_state_dumper(fault_address, fault_instruction); |
514 |
|
} |
515 |
|
} |
516 |
|
#endif |
557 |
|
} |
558 |
|
#endif |
559 |
|
|
560 |
< |
bool sigsegv_install_handler(sigsegv_handler_t handler) |
560 |
> |
bool sigsegv_install_handler(sigsegv_fault_handler_t handler) |
561 |
|
{ |
562 |
|
#ifdef HAVE_SIGSEGV_RECOVERY |
563 |
< |
sigsegv_user_handler = handler; |
563 |
> |
sigsegv_fault_handler = handler; |
564 |
|
bool success = true; |
565 |
|
#define FAULT_HANDLER(sig) success = success && sigsegv_do_install_handler(sig); |
566 |
|
SIGSEGV_ALL_SIGNALS |
580 |
|
void sigsegv_deinstall_handler(void) |
581 |
|
{ |
582 |
|
#ifdef HAVE_SIGSEGV_RECOVERY |
583 |
< |
sigsegv_user_handler = 0; |
583 |
> |
sigsegv_fault_handler = 0; |
584 |
|
#define FAULT_HANDLER(sig) signal(sig, SIG_DFL); |
585 |
|
SIGSEGV_ALL_SIGNALS |
586 |
|
#undef FAULT_HANDLER |
602 |
|
* Set callback function when we cannot handle the fault |
603 |
|
*/ |
604 |
|
|
605 |
< |
void sigsegv_set_dump_state(sigsegv_handler_t handler) |
605 |
> |
void sigsegv_set_dump_state(sigsegv_state_dumper_t handler) |
606 |
|
{ |
607 |
< |
sigsegv_dump_state = handler; |
607 |
> |
sigsegv_state_dumper = handler; |
608 |
|
} |
609 |
|
|
610 |
|
|