From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16608 invoked by alias); 23 Jun 2008 14:23:26 -0000 Received: (qmail 16594 invoked by uid 22791); 23 Jun 2008 14:23:24 -0000 X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.159) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 23 Jun 2008 14:23:03 +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 m5NEMxMW066582 for ; Mon, 23 Jun 2008 16:22:59 +0200 (CEST) Received: from mailserver.u-strasbg.fr (ms2.u-strasbg.fr [IPv6:2001:660:2402::142]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id m5NEMxjl012603 for ; Mon, 23 Jun 2008 16:22:59 +0200 (CEST) Received: from d620muller (www-ics.u-strasbg.fr [130.79.210.225]) by mailserver.u-strasbg.fr (8.13.8/jtpda-5.5pre1) with ESMTP id m5NEMu6D036589 for ; Mon, 23 Jun 2008 16:22:59 +0200 (CEST) From: "Pierre Muller" To: References: <000001c8d330$0c6b51f0$2541f5d0$@u-strasbg.fr> <20080621170521.GB2470@ednor.casa.cgf.cx> <20080621172115.GA2033@caradoc.them.org> <20080621183648.GV20180@calimero.vinschen.de> <20080622031804.GB4200@ednor.casa.cgf.cx> <000101c8d501$3882d100$a9887300$@u-strasbg.fr> <20080623114505.GA9244@ednor.casa.cgf.cx> In-Reply-To: <20080623114505.GA9244@ednor.casa.cgf.cx> Subject: RE: [RFC] win32-nat.c 'set new-console' and interruption Date: Mon, 23 Jun 2008 16:05:00 -0000 Message-ID: <001001c8d53c$a773fe50$f65bfaf0$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Content-Language: en-us X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (mailhost.u-strasbg.fr [IPv6:2001:660:2402::159]); Mon, 23 Jun 2008 16:22:59 +0200 (CEST) X-Virus-Status: Clean 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: 2008-06/txt/msg00385.txt.bz2 > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Christopher Faylor > Envoy=E9=A0: Monday, June 23, 2008 1:45 PM > =C0=A0: gdb-patches@sourceware.org; Pierre Muller > Objet=A0: Re: [RFC] win32-nat.c 'set new-console' and interruption >=20 > On Mon, Jun 23, 2008 at 09:17:39AM +0200, Pierre Muller wrote: > >I will resend a new patch proposal that complies with the lowercase > >coding standard rule shortly. >=20 > That was only the most minor problem. The race condition is something > that needs to be addressed before the patch can be considered. I agree with you on this. I have a proposal to remove that possible race condition: The exception record has a field that contains the exception address, if I test that there is no GDB inserted breakpoint at that location before converting the TARGET_SIGNAL_TRAP into a TARGET_SIGNAL_INT, it should fix most problems, no? The one case that it would still not catch would be=20 a 'int 3' instruction that is in the debuggee code from the start but other than at startup, such instructions are quite unlikely, no? Is this a sufficient fix for the possible race or should I try harder? Pierre Muller Pascal language support maintainer for GDB PS: I have two code formatting issues in my modified code: 1) the CORE_ADDR addr assignment line goes past the 80 row boundary, even if I put the current_event on a separate line would + CORE_ADDR addr =3D (CORE_ADDR) + current_event.u.Exception.ExceptionRecord.ExceptionAddress;=20 be acceptable to avoid going past 80? 2) For the DEBUG_EXCEPT macro use that I added, I am also unsure about the formatting, as I had to cut the line within the string. Modified code to remove the race condition between an exception create by DebugBreakProcess and an exception created by the 'int 3' instruction inserted by GDB for breakpoints. @@ -1076,7 +1079,22 @@ handle_exception (struct target_waitstat break; case EXCEPTION_BREAKPOINT: DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_BREAKPOINT"); - ourstatus->value.sig =3D TARGET_SIGNAL_TRAP; + if (ctrl_break_sent) + + { + CORE_ADDR addr =3D + (CORE_ADDR) current_event.u.Exception.ExceptionRecord.ExceptionAddress; + + if (!breakpoint_inserted_here_p (addr)) + { + DEBUG_EXCEPT (("EXCEPTION_BREAKPOINT at 0x%lx converted to \ +TARGET_SIGNAL_INT\n", (DWORD) addr)); + ctrl_break_sent =3D 0; + ourstatus->value.sig =3D TARGET_SIGNAL_INT; + } + } + else + ourstatus->value.sig =3D TARGET_SIGNAL_TRAP; break; case DBG_CONTROL_C: DEBUG_EXCEPTION_SIMPLE ("DBG_CONTROL_C");