This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: perl threads on 2008 R2 64bit = crash ( was: perl 5.10 threads on 1.5.25 = instant crash )

Corinna Vinschen <corinna-cygwin <at>> 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)
  ExceptionInfo.ExceptionRecord = exception;
  ExceptionInfo.ContextRecord = context;
  if (main_exception_filter (&ExceptionInfo) == EXCEPTION_CONTINUE_SEARCH)
    return cygwin_exception_handler (exception, frame, context, dispatch);
    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:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]