Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com> List-Archive: <http://sources.redhat.com/ml/cygwin/> List-Post: <mailto:cygwin AT cygwin DOT com> List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Thu, 3 Oct 2002 18:21:34 -0400 From: Allen Leung <allen DOT leung AT aleri DOT com> To: cygwin AT cygwin DOT com Cc: Allen Leung <allen DOT leung AT aleri DOT com> Subject: Re: Bypassing cygwin's signal handling Message-ID: <20021003182134.A25363@aleri.com> Reply-To: allen DOT leung AT aleri DOT com References: <20021003174509 DOT A24847 AT aleri DOT com> <Pine DOT GSO DOT 4 DOT 44 DOT 0210031746330 DOT 13573-100000 AT slinky DOT cs DOT nyu DOT edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <Pine.GSO.4.44.0210031746330.13573-100000@slinky.cs.nyu.edu>; from pechtcha@cs.nyu.edu on Thu, Oct 03, 2002 at 05:59:06PM -0400 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/