X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:date:from:to:subject:message-id:references
	:mime-version:content-type:in-reply-to; q=dns; s=default; b=tDVu
	iDkNdNVCnIvTFZbZiQsOge0VegYmrHmDyRwPw5/WVHLqNiJa5vACkoNcI9mn8Uv1
	FTwR1nyXJKo8ABnJUQuTYa7uA0lbxFM1UllJ3p76XYdMEUZxeMW0R83gon0USea0
	kxm7bx8qPOLKYPv5U9siyxNqjejm0bOM2+hNMyo=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:date:from:to:subject:message-id:references
	:mime-version:content-type:in-reply-to; s=default; bh=I4Ezof1eLP
	qnwBJk99T0xlA45+c=; b=NMPRpW5M6+1dgdtPxQvn3N8KqOgicshatl1MweE+Ps
	KFP9B4q3jg0YQvOZmFeOol9BmI4BRGFJyU+S+11QBWFo88JtoAqPkdhVbBtgehlt
	piB19BTAawY5EM+8i7VHoAgk4PomYxYUgZer6F5ZUs5FPZ8z51O3n0TtrL/qUW2X
	I=
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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Mon, 3 Mar 2014 16:02:10 +0100
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Building libsigsegv on Cygwin64
Message-ID: <20140303150210.GC2469@calimero.vinschen.de>
Mail-Followup-To: cygwin@cygwin.com
References: <530771A3.7000603@alice.it> <53136870.200@cornell.edu>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;	protocol="application/pgp-signature"; boundary="ftEhullJWpWg/VHq"
Content-Disposition: inline
In-Reply-To: <53136870.200@cornell.edu>
User-Agent: Mutt/1.5.21 (2010-09-15)

--ftEhullJWpWg/VHq
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mar  2 12:20, Ken Brown wrote:
> On 2/21/2014 10:32 AM, Angelo Graziosi wrote:
> >Trying to build libsigsegv-2.10 on Cygwin64 (using the src tarball and
> >its .cygport file from x86 distribution), fails as follows
> >
> >[...]
> >libtool: compile:  gcc -DHAVE_CONFIG_H -I.
> >-I/works/tmp/libsigsegv-2.10-1/src/libsigsegv-2.10/src -I.. -I.
> >-I/works/tmp/libsigsegv-2.10-1/src/libsigsegv-2.10/src -ggdb -O2 -pipe
> >-Wimplicit-function-declaration
> >-fdebug-prefix-map=3D/works/tmp/libsigsegv-2.10-1/build=3D/usr/src/debug=
/libsigsegv-2.10-1
> >-fdebug-prefix-map=3D/works/tmp/libsigsegv-2.10-1/src/libsigsegv-2.10=3D=
/usr/src/debug/libsigsegv-2.10-1
> >-c /works/tmp/libsigsegv-2.10-1/src/libsigsegv-2.10/src/handler.c
> >-DDLL_EXPORT -DPIC -o .libs/handler.o
> >In file included from
> >/works/tmp/libsigsegv-2.10-1/src/libsigsegv-2.10/src/handler.c:20:0:
> >/works/tmp/libsigsegv-2.10-1/src/libsigsegv-2.10/src/handler-win32.c: In
> >function 'main_exception_filter':
> >/works/tmp/libsigsegv-2.10-1/src/libsigsegv-2.10/src/handler-win32.c:218=
:43:
> >error: 'struct _CONTEXT' has no member named 'Esp'
> >                ExceptionInfo->ContextRecord->Esp =3D new_safe_esp;
> >                                            ^
> >/works/tmp/libsigsegv-2.10-1/src/libsigsegv-2.10/src/handler-win32.c:220=
:43:
> >error: 'struct _CONTEXT' has no member named 'Eip'
> >                ExceptionInfo->ContextRecord->Eip =3D (unsigned
> >long)&stack_overflow_handler;
> >                                            ^
> >Makefile:399: set di istruzioni per l'obiettivo "handler.lo" non riuscito
> >make[1]: *** [handler.lo] Errore 1
> >make[1]: uscita dalla directory "/works/tmp/libsigsegv-2.10-1/build/src"
> >Makefile:344: set di istruzioni per l'obiettivo "install-recursive" non
> >riuscito
> >make: *** [install-recursive] Errore 1
> >
> >Since my Cygwin64 is a fesh installation, I wonder if I missed to
> >installe some needed packages... or is that error to be expected on
> >Cygwin64?
>=20
> I found the problem (or at least I found *a* problem):  There's a
> configure test "checking whether a fault handler according to POSIX
> works", which passes on 32-bit Cygwin but fails on 64-bit Cygwin.
> I'm attaching a file containing the configure test.  Here's what
> happens in the 64-bit case:
>=20
> $ gcc -o fault fault.c
> $ ./fault.exe
> $ echo $?
> 1
>=20
> In the 32-bit case, the exit code is 0.
>=20
> I don't know if this indicates a Cygwin bug or something wrong with
> the test.

It indicates a Cygwin bug.  Thanks for the report and the testcase.

The joke here is, the signal handler function gets called twice for the
same exception.  Proof is that you can remove the second call to crasher
and still sigsegv_handler gets called twice.

I see why this happens, but I'm not quite sure yet how to fix it
completely.  I can easily fix this for the normal case as well as for
the case a process gets started by the debugger.  But I have trouble as
soon as a debugger gets attached to a process after the process already
started.

Does anybody know if there's a way for a process to be getting notified
if a debugger attaches to or detaches from it?


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--ftEhullJWpWg/VHq
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJTFJlyAAoJEPU2Bp2uRE+glFsP/Rbqkq+BkcRBfRLS/azeryxJ
ldMgPRODEB8MRHsDIKyMl6PfhPncr5IrMV7t9qglBMm6Qrn1Yv5ZBSmDRpSoGnTW
WnroYs40A4Jbnu/6DCxtBr5sltfMwQNJ4jciqUJE8a2zWOWov1Cpa3Os8AWxNpLE
qepxAmGBxfNih8Zff5eFfqcpFK9jtquGLlL5aXnDvz+hCZ5KhSwhRAcm71yJu45j
mJrBjO5Z9u8V6xCVJfJqe6Mtlwttv36kcc1xpugVqGuUEZwlIJJ6UtpOu4PFKdOR
taGOtBfLeHAo9Pcfo9avGUQ+zXH0dCNsGvz3ggIsSQ9NFkpTec1zQmScemZnEq/b
t0kcpea01xWqkbGnS6aF+//uwnEe5b4TDEs5dm/dF7PGy3ynmFrR5wf35C4ppfSN
i3n42/gaH7KeeGhX3G/1fXM6sDCJTE1bEFklN/wtym2Wgfkl2owJL3dkkFGBer0S
zTWDvNTHDglj51QaLIotkUKUKc8Mf2x7+XM/hXZOWQWpjxIbQkewMQ3EUYGPbzhX
t16lco2lbWNyYZgXdy3IT6ACT2vgVdZ7ezo/Pf7fylhb0SzAMNWK5ibbn+mlQKTW
K2ex/7S/Rt401cm8xjoKhOIvajP5sImQyW8jvrDJ+csByy3QdwxsgfIpl8KD6Nou
d9+hpVWjvI2FqvGUdZsw
=hVI2
-----END PGP SIGNATURE-----

--ftEhullJWpWg/VHq--
