Bypassing cygwin's signal handling

Allen Leung allen.leung@aleri.com
Thu Oct 3 15:22:00 GMT 2002


On Thu, Oct 03, 2002 at 05:59:06PM -0400, Igor Pechtchanski wrote:
> 
> Hey, Allen! (Of all places to meet here :-D)
> 
> Cygwin currently does not support SA_SIGINFO signal handling.  It's on the
> TODO list ( http://cygwin.com//cgi-bin/cygwin-todo.cgi?20020722.130725 ),
> but I didn't have the time to work on it yet...
> 
> As far as I know, there is currently no way to retrieve the fault
> information from a Unix-style signal handler in Cygwin.  You might try to
> patch the Cygwin DLL to ignore a particular signal (in
> winsup/cygwin/exceptions.cc), and then write your own Windows-style
> handler...  It'll probably be quite a bit of work.  Another idea would be
> to include a callback to your own function in handle_exceptions().  In
> either case, you'll have to build a custom cygwin1.dll...
> 	Igor

Hey Igor,

   Thanks for the info.  

   I don't want to modify the cygwin.dll.  Convincing everyone in
the company to install my own hacked up dll is not an option.  
 
   Looking at winsup/cygwin/exception.cc, I see this: 

// Set up the exception handler for the current thread.
// The x86 on the other hand uses segment register fs, 
// offset 0 to point to the current exception handler.

static void init_exception_handler (exception_list *el)
{
  el->handler = handle_exceptions;
  el->prev = _except_list;
  _except_list = el;
}

   So all I have to do to catch page fault in my program 
is to push another exception record on the %fs list (for each thread
that I spawn) to override the default cygwin handler.  Have I overlooked
something?

cheers,
allen

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list