+# elif defined(irix6_TARGET_OS)
+
+static void
+segv_handler(int sig, siginfo_t *sip, void *dummy)
+{
+ fflush(stdout);
+ if (sip == NULL) {
+ fprintf(stderr, "Segmentation fault caught, address unknown\n");
+ } else {
+ if (sip->si_addr >= (void *) stks_space
+ && sip->si_addr < (void *) (stks_space + RTSflags.GcFlags.stksSize))
+ StackOverflow();
+ fprintf(stderr, "Segmentation fault caught, address = %08lx\n", (W_) sip->si_addr);
+ }
+ abort();
+}
+
+int
+install_segv_handler(STG_NO_ARGS)
+{
+ struct sigaction action;
+
+ action.sa_sigaction = segv_handler;
+ sigemptyset(&action.sa_mask);
+ action.sa_flags = SA_SIGINFO;
+
+ return sigaction(SIGSEGV, &action, NULL);
+}
+
+# elif defined(cygwin32_TARGET_OS)
+
+/*
+ The signal handlers in cygwin32 (beta14) are only passed the signal
+ number, no sigcontext/siginfo is passed as event data..sigh. For
+ SIGSEGV, to get at the violating address, we need to use the Win32's
+ WaitForDebugEvent() to get out any status information.
+*/
+static void
+segv_handler(sig)
+ int sig;
+{
+ /* From gdb/win32-nat.c */
+ DEBUG_EVENT event;
+ BOOL t = WaitForDebugEvent (&event, INFINITE);
+
+ fflush(stdout);
+ if (t == FALSE) {
+ fprintf(stderr, "Segmentation fault caught, address unknown\n");
+ } else {
+ void *si_addr = event.u.Exception.ExceptionRecord.ExceptionAddress;
+ if (si_addr >= (void *) stks_space
+ && si_addr < (void *) (stks_space + RTSflags.GcFlags.stksSize))
+ StackOverflow();
+
+ fprintf(stderr, "Segmentation fault caught, address = %08lx\n", (W_)si_addr);
+ }
+ abort();
+}
+
+int
+install_segv_handler()
+{
+ return (int) signal(SIGSEGV, segv_handler) == -1;
+}
+
+
+# else /* ! (cygwin32|irix6|sunos4|linux*|*bsd|aix) */