From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5567 invoked by alias); 3 Jun 2009 23:33:46 -0000 Received: (qmail 5558 invoked by uid 22791); 3 Jun 2009 23:33:45 -0000 X-SWARE-Spam-Status: No, hits=-2.2 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.154) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 03 Jun 2009 23:33:40 +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 n53NXRFZ025645 ; Thu, 4 Jun 2009 01:33:27 +0200 (CEST) Received: from mailserver.u-strasbg.fr (ms1.u-strasbg.fr [IPv6:2001:660:2402:d::10]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id n53NXROb018140 ; Thu, 4 Jun 2009 01:33:27 +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 n53NXQKR019931 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) ; Thu, 4 Jun 2009 01:33:26 +0200 (CEST) (envelope-from muller@ics.u-strasbg.fr) From: "Pierre Muller" To: "'Eli Zaretskii'" Cc: References: <000301c9e49e$c479eba0$4d6dc2e0$@u-strasbg.fr> In-Reply-To: Subject: RE: [RFA] Fix a windows bug if two watchpoints are used Date: Wed, 03 Jun 2009 23:33:00 -0000 Message-ID: <000601c9e4a3$b2f2f980$18d8ec80$@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-06/txt/msg00056.txt.bz2 > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Eli Zaretskii > Envoy=E9=A0: Thursday, June 04, 2009 1:21 AM > =C0=A0: Pierre Muller > Cc=A0: gdb-patches@sourceware.org > Objet=A0: Re: [RFA] Fix a windows bug if two watchpoints are used >=20 > > From: "Pierre Muller" > > Date: Thu, 4 Jun 2009 00:58:09 +0200 > > > > Now comes the tricky part, why does that generate a > > SIGTRAP? > > In i386_stopped_data_address, > > the bits of dr_status_mirror (copied from current value of dr[6]) > > are checked from 0 to 3, but if hit is found for I, > > the address value is taken from dr_mirror array. > > > > Thus, according to dr[6], both debug registers 0 and 1 > > have been hit. > > at i=3D0, the correct address of ival3 is found in dr_mirror[0], > > but after for i=3D1, the value of dr_mirror[1] is used, but this > > value is 0, as only one watch is active. >=20 > Shouldn't we instead fix the logic of i386_stopped_data_address, to > get out of the loop on the first watchpoint that is found to be hit? > The function does not support more than one watchpoint anyway, so why > continue checking the bits in dr[6] after we've found one set already? >=20 > Would such a change fix your problem without the other complications? It would hide the problem. But what happens if you have different watchpoints on the same address (say one 'watch' and one 'awatch')? Are you sure your suggestion would not affect such cases? > Btw, I don't understand this part of i386_stopped_data_address: >=20 > if (maint_show_dr && addr =3D=3D 0) > i386_show_dr ("stopped_data_addr", 0, 0, hw_write); >=20 > Isn't that backwards? why display the address if it is zero? I think this is because if addr is non-zero, you already have a call to i386_show_dr before with "watchpoint hit". This call is simply to state that stopped_data_address was called but didn't find a hit. But the correct condition should be (rc =3D=3D 0) instead of (addr =3D=3D 0) as setting a watchpoint at (CORE_ADDR) 0 should also work on target where this address is not protected. Pierre