From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16412 invoked by alias); 4 Jun 2009 14:52:03 -0000 Received: (qmail 16400 invoked by uid 22791); 4 Jun 2009 14:52:02 -0000 X-SWARE-Spam-Status: No, hits=-2.1 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.157) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Jun 2009 14:51:57 +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 n54EppdO065643 ; Thu, 4 Jun 2009 16:51:51 +0200 (CEST) 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 n54EppNp005964 ; Thu, 4 Jun 2009 16:51:51 +0200 (CEST) (envelope-from muller@ics.u-strasbg.fr) Received: from d620muller (www-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id n54EppCq043970 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) ; Thu, 4 Jun 2009 16:51:51 +0200 (CEST) (envelope-from muller@ics.u-strasbg.fr) From: "Pierre Muller" To: "'Eli Zaretskii'" Cc: References: <000301c9e49e$c479eba0$4d6dc2e0$@u-strasbg.fr> <000601c9e4a3$b2f2f980$18d8ec80$@u-strasbg.fr> <000001c9e4de$6e550cb0$4aff2610$@u-strasbg.fr> <000301c9e4e6$b40c5d50$1c2517f0$@u-strasbg.fr> In-Reply-To: Subject: RE: [RFA-v2] Fix a windows bug if two watchpoints are used Date: Thu, 04 Jun 2009 14:52:00 -0000 Message-ID: <001501c9e523$feffc1c0$fcff4540$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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/msg00069.txt.bz2 > > My problem is indeed fixed without that part, > > but without my change to I386_DR_DISABLE, the second check > > in i386_stopped_data_address: > > > > ALL_DEBUG_REGISTERS(i) > > { > > if (I386_DR_WATCH_HIT (i) > > /* This second condition makes sure DRi is set up for a data > > watchpoint, not a hardware breakpoint. The reason is > > that GDB doesn't call the target_stopped_data_address > > method except for data watchpoints. In other words, I'm > > being paranoiac. */ > > && I386_DR_GET_RW_LEN (i) != 0) > > > > is not reliable as the return value of I386_DR_GET_RW_LEN (i) > > is non-zero if I was used before... Even if it was disabled > > later! > > This is C: if the result of the first test is false, the result of the > second test is not important, right? > > Or am I missing something? If all works fine, there is no problem, you are right, but otherwise... If, like for my cygwin problem, dr_status_mirror has both bits 1 and 2 set while only the first debug register is used according to previous calls of the i386-nat functions. This is probably an OS problem, but the whole thread is related to that... In that situation, the second test, which is supposed to check if indeed we have that second register used as a hardware watchpoint, and not a hardware breakpoint, according to the comment, fails. Maybe we should use ALL_DEBUG_REGISTERS(i) { if (I386_DR_WATCH_HIT (i) && !I386_DR_VACANT(i) && I386_DR_GET_RW_LEN (i) != 0) In that case, I think that the code should be fine even if the underlying OS reports a spurious bit of the debug status register as set. Pierre