The following patch adds a Parrot_nosegfault() function
to win32.c; after it is called, a segmentation fault will print
"This process received a segmentation violation exception"
instead of popping up a dialog. I think it might be useful
for tinderbox clients.

Regards
Mattia

Index: platforms/win32.c
===================================================================
RCS file: /home/perlcvs/parrot/platforms/win32.c,v
retrieving revision 1.5
diff -u -2 -r1.5 win32.c
--- platforms/win32.c   14 Jan 2002 20:04:32 -0000      1.5
+++ platforms/win32.c   8 Feb 2002 18:15:16 -0000
@@ -7,4 +7,25 @@
 #include "parrot/parrot.h"
 
+/*
+ * Parrot_nosegfault()
+ */
+
+LONG CALLBACK Parrot_win32_filter ( EXCEPTION_POINTERS* exceptionInfo )
+{
+  /* only trap segmentation violations */
+  if( exceptionInfo->ExceptionRecord->ExceptionCode ==
+      EXCEPTION_ACCESS_VIOLATION )
+  {
+    printf("This process received a segmentation violation exception\n");
+    exit(1);
+  }
+
+  return EXCEPTION_CONTINUE_SEARCH;
+}
+
+void Parrot_nosegfault ()
+{
+  SetUnhandledExceptionFilter( Parrot_win32_filter );
+}
 
 /*
Index: platforms/win32.h
===================================================================
RCS file: /home/perlcvs/parrot/platforms/win32.h,v
retrieving revision 1.6
diff -u -2 -r1.6 win32.h
--- platforms/win32.h   29 Jan 2002 18:39:20 -0000      1.6
+++ platforms/win32.h   8 Feb 2002 18:15:16 -0000
@@ -26,5 +26,5 @@
 FLOATVAL Parrot_floatval_time (void);
 void Parrot_setenv(const char * name, const char * value);
-
+void Parrot_nosegfault();
 
 /*

Reply via email to