GC on Linux: adjust handler to not abort on SI_KERNEL signals

The meaning of SI_KERNEL signals is not clear, but ignoring
them seems to let the process continue ok. (These signals show
up when running `typed-racket-test/main --int`.)
This commit is contained in:
Matthew Flatt 2016-03-26 12:31:08 -06:00
parent 92f4f8ad10
commit f7182e7a5c

View File

@ -78,20 +78,22 @@ void fault_handler(int sn, siginfo_t *si, void *ctx)
*/ */
} }
if (c == 0) { if (c == 0) {
/* I have no idea why this happens on linux */ /* When running w/ places in gdb, the debugger
/* supposedly its coming from the user via kill */ sometimes propagates extra copies of signals
/* so just ignore it. It appears when */ that crash the process. Ignore them (but they're
/* running w/ places in GDB */ rare enough that it's worth reporting that the signal
printf("SIGSEGV SI_USER SI_ERRNO %i fault on addr %p\n", si->si_errno, p); was received). */
#ifdef MZ_USE_PLACES printf("Signal as SI_USER (from debugger?) - ignoring\n");
printf("pid %i uid %i thread %lx\n", si->si_pid, si->si_uid, mz_proc_os_thread_self());
#else
printf("pid %i uid %i\n", si->si_pid, si->si_uid);
#endif
return; return;
} }
if (c == 128) { if (c == 128) {
printf("SIGSEGV SI_KERNEL SI_ERRNO %i fault on addr %p\n", si->si_errno, p); /* A mysterious signal on Linux, probably the OS providing some
kind of alert. These can be frequent enough that printing
an alert is too noisy. */
if (0) {
printf("Signal as SI_KERNEL - ignoring\n");
}
return;
} }
#if WAIT_FOR_GDB #if WAIT_FOR_GDB
launchgdb(); launchgdb();