X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 	tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
To: cygwin@cygwin.com
From: Eric Blake <ebb9@byu.net>
Subject:  libsigsegv error handling (was: perl threads on 2008 R2 64bit)
Date: Fri, 17 Jul 2009 14:52:07 +0000 (UTC)
Lines: 40
Message-ID:  <loom.20090717T144655-62@post.gmane.org>
References:  <20090715185636.GA16211@ednor.casa.cgf.cx> <4A5E2ED6.3070502@gmail.com> <20090715194539.GZ27613@calimero.vinschen.de> <4A5E3F1F.9040103@gmail.com> <20090716161219.GP27613@calimero.vinschen.de> <4A5F59A1.1060902@gmail.com> <20090716195552.GU27613@calimero.vinschen.de> <20090716211823.GC22617@ednor.casa.cgf.cx> <20090717085727.GW27613@calimero.vinschen.de> <4A607EE5.5050306@gmail.com> <20090717134114.GX27613@calimero.vinschen.de> <loom.20090717T140900-805@post.gmane.org> <4A608C72.2010504@gmail.com>
Mime-Version:  1.0
Content-Type:  text/plain; charset=us-ascii
Content-Transfer-Encoding:  7bit
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Dave Korn <dave.korn.cygwin <at> googlemail.com> writes:

>   That looks fairly robust to me, shouldn't give us any problems.  Question
> is, what does the code that hooks and unhooks the exception handler look like,
> and where does it get called from?

static void
do_install_main_exception_filter ()
{
  /* We cannot insert any handler into the chain, because such handlers
     must lie on the stack (?).  Instead, we have to replace(!) Cygwin's
     global exception handler.  */
  cygwin_exception_handler = _except_list->handler;
  _except_list->handler = libsigsegv_exception_handler;
}

static void
install_main_exception_filter ()
{
  static int main_exception_filter_installed = 0;

  if (!main_exception_filter_installed)
    {
      do_install_main_exception_filter ();
      main_exception_filter_installed = 1;
    }
}

It looks like it is installed, never uninstalled.  And although the current 
release of libsigsegv is a static-only library, Bruno is proud of the fact that 
his libsigsegv package can be provided as a dynamic library even on cygwin (in 
other words, the current cygwin maintainer of the libsigsegv package could 
decide to pass the right configure options to make libsigsegv a .dll, at which 
point a rebuild of m4 would then be subject to issues of a .dll playing with 
the exception filter).  Is there a chance that this represents a bug in 
libsigsegv SEH handling that needs to be reported upstream?

-- 
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

