under linux, run write-barrier signal handler on alternate stack
svn: r18124
This commit is contained in:
parent
5763cc0104
commit
008e7b3121
|
@ -41,8 +41,6 @@ static void launchgdb() {
|
|||
void fault_handler(int sn, struct siginfo *si, void *ctx)
|
||||
{
|
||||
void *p = si->si_addr;
|
||||
int c = si->si_code;
|
||||
int m = 0;
|
||||
if (si->si_code != SEGV_ACCERR) { /*SEGV_MAPERR*/
|
||||
printf("SIGSEGV fault on %p\n", p);
|
||||
#if WAIT_FOR_GDB
|
||||
|
@ -66,6 +64,7 @@ void fault_handler(int sn, struct siginfo *si, void *ctx)
|
|||
}
|
||||
abort();
|
||||
}
|
||||
# define NEED_SIGSTACK
|
||||
# define NEED_SIGACTION
|
||||
# define USE_SIGACTON_SIGNAL_KIND SIGSEGV
|
||||
}
|
||||
|
@ -153,6 +152,17 @@ static void initialize_signal_handler(GCTYPE *gc)
|
|||
macosx_init_exception_handler(1);
|
||||
# endif
|
||||
# endif
|
||||
# ifdef NEED_SIGSTACK
|
||||
{
|
||||
stack_t ss;
|
||||
|
||||
ss.ss_sp = malloc(SIGSTKSZ);
|
||||
ss.ss_size = SIGSTKSZ;
|
||||
ss.ss_flags = 0;
|
||||
|
||||
sigaltstack(&ss, NULL);
|
||||
}
|
||||
# endif
|
||||
# ifdef NEED_SIGACTION
|
||||
{
|
||||
struct sigaction act, oact;
|
||||
|
@ -163,6 +173,9 @@ static void initialize_signal_handler(GCTYPE *gc)
|
|||
sigaddset(&act.sa_mask, SIGINT);
|
||||
sigaddset(&act.sa_mask, SIGCHLD);
|
||||
act.sa_flags = SA_SIGINFO;
|
||||
# ifdef NEED_SIGSTACK
|
||||
act.sa_flags |= SA_ONSTACK;
|
||||
# endif
|
||||
sigaction(USE_SIGACTON_SIGNAL_KIND, &act, &oact);
|
||||
}
|
||||
# endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user