From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15721 invoked by alias); 21 Sep 2009 22:35:41 -0000 Received: (qmail 15711 invoked by uid 22791); 21 Sep 2009 22:35:40 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.151) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 21 Sep 2009 22:35:36 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.2/jtpda-5.5pre1) with ESMTP id n8LMZX2q060066 for ; Tue, 22 Sep 2009 00:35:33 +0200 (CEST) (envelope-from muller@ics.u-strasbg.fr) Received: from mailserver.u-strasbg.fr (ms2.u-strasbg.fr [IPv6:2001:660:2402:d::11]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id n8LMZXCx092471 for ; Tue, 22 Sep 2009 00:35:33 +0200 (CEST) (envelope-from muller@ics.u-strasbg.fr) Received: from d620muller (lec67-4-82-230-53-140.fbx.proxad.net [82.230.53.140]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id n8LMZWhK074152 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Tue, 22 Sep 2009 00:35:32 +0200 (CEST) (envelope-from muller@ics.u-strasbg.fr) From: "Pierre Muller" To: References: <001d01ca3ace$4878c9f0$d96a5dd0$@u-strasbg.fr> <20090921222637.GC17886@ednor.casa.cgf.cx> In-Reply-To: <20090921222637.GC17886@ednor.casa.cgf.cx> Subject: RE: [RFA] windows-nat.c Cygwin save_context fix Date: Mon, 21 Sep 2009 22:35:00 -0000 Message-ID: <000001ca3b0b$d8310250$889306f0$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-09/txt/msg00688.txt.bz2 > -----Message d'origine----- > De=A0: Christopher Faylor [mailto:cgf-use-the-mailinglist- > please@sourceware.org] > Envoy=E9=A0: Tuesday, September 22, 2009 12:27 AM > =C0=A0: gdb-patches@sourceware.org; Pierre Muller > Objet=A0: Re: [RFA] windows-nat.c Cygwin save_context fix >=20 > On Mon, Sep 21, 2009 at 05:14:57PM +0200, Pierre Muller wrote: > > Cygwin has a way to give a "fake" context for > >an exception using a OUTPUT_DEBUG_STRING_EVENT. > > > > While trying to debug some crashes inside cygwin dll, > >I realized the the saved_context code has a problem. > > > > The saved context was correctly written to the thread_info > >struct, but later overwritten by a call to GetThreadContext. > > > > After the cygwin special output_debug_string was correctly > >converted into a context stored in saved_context. > > The next call to do_windows_fetch_inferior_registers > >then copied this context to the thread_info struct, > >set the reload_context field to zero. > > > > But a later call to thread_rec() with get_context=3D1 > >can reset reload_context to one, if suspended field > >is zero (this only happens if it is not the main thread). > > > > My patch fixes the problem by explicitly calling > >SuspendThread for the threaded of the saved_context > >if suspended is still zero at that point. > > > > > >Pierre Muller > >Pascal language support maintainer for GDB > > > > > > > >2009-09-21 Pierre Muller > > > > * src/gdb/windows-nat.c (saved_threadid): New variable. > > (do_windows_fetch_inferior_registers): Check for correct thread > id > > and force call to SuspendThread if needed. > > (handle_output_debug_string): Set saved_threadid. >=20 > I REALLY hate SuspendThread and am not likely to accept a patch which > uses it as a solution. I don't think that we really need to call SuspendThread, in fact, I suspect the best would be to set suspended to -1 as for main_threadid. I will try to check out if this also works. > I don't really understand the scenario that you are talking about since > I (obviously?) have no problems debugging SEGVs in cygwin. However, I was trying to debug a home compiled expect=20 linked to 8.5.7 tcl library, that was call abort, and the subsequent cygwin stackdump was segfaulting. > would just removing the "have_saved_context =3D 0;" from > do_windows_fetch_inferior_registers fix the problem? But them we need to be really careful about to where we should reset it to zero, otherwise we might end up=20 by still copying saved_context, even after having reran the debuggee, no? Pierre