Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes: > Do we have to take other handlers than the OS handlers and the Cygwin > handlers into account? Cygwin apps don't install SEH handlers, do > they? Or do C++ apps?
I believe that libsigsegv does its magic by installing an SEH handler. libsigsegv is a C library, used (among others) by the cygwin build of m4 1.4.13. I also know that one of the new features in the recently announced beta version of gawk is the addition of support for using libsigsegv. At any rate, these snippets from the libsigsegv source are somewhat telling: /* In Cygwin programs, SetUnhandledExceptionFilter has no effect because Cygwin installs a global exception handler. We have to dig deep in order to install our main_exception_filter. */ /* Data structures for the current thread's exception handler chain. On the x86 Windows uses register fs, offset 0 to point to the current exception handler; Cygwin mucks with it, so we must do the same... :-/ */ /* Magic taken from winsup/cygwin/include/exceptions.h. */ /* Cygwin's original exception handler. */ static int (*cygwin_exception_handler) (EXCEPTION_RECORD *, void *, CONTEXT *, void *); /* Our exception handler. */ static int libsigsegv_exception_handler (EXCEPTION_RECORD *exception, void *frame, CONTEXT *context, void *dispatch) { EXCEPTION_POINTERS ExceptionInfo; ExceptionInfo.ExceptionRecord = exception; ExceptionInfo.ContextRecord = context; if (main_exception_filter (&ExceptionInfo) == EXCEPTION_CONTINUE_SEARCH) return cygwin_exception_handler (exception, frame, context, dispatch); else return 0; } [m4 wouldn't need to use libsigsegv if cygwin provided sigaltstack, but that's an entirely different can of worms.] -- Eric Blake -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple