From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11396 invoked by alias); 22 Jun 2014 18:31:30 -0000 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 Received: (qmail 11376 invoked by uid 89); 22 Jun 2014 18:31:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sun, 22 Jun 2014 18:31:17 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5MIVEhA006704 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 22 Jun 2014 14:31:14 -0400 Received: from host2.jankratochvil.net (ovpn-116-53.ams2.redhat.com [10.36.116.53]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5MIVAYG017331 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Sun, 22 Jun 2014 14:31:13 -0400 Date: Sun, 22 Jun 2014 18:31:00 -0000 From: Jan Kratochvil To: Pedro Alves Cc: Doug Evans , "gdb-patches@sourceware.org" Subject: Re: [PATCH] x86 Linux watchpoints: Couldn't write debug register: Invalid, argument. Message-ID: <20140622183110.GA25638@host2.jankratochvil.net> References: <1394154640-14053-3-git-send-email-palves@redhat.com> <53272CB0.6050101@redhat.com> <532AF3D0.8090904@redhat.com> <20140617191850.GA10997@host2.jankratochvil.net> <20140619134330.GA14567@host2.jankratochvil.net> <53A2FB68.9090500@redhat.com> <53A3164E.4020109@redhat.com> <20140619170029.GA31275@host2.jankratochvil.net> <53A46706.8010601@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53A46706.8010601@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2014-06/txt/msg00796.txt.bz2 On Fri, 20 Jun 2014 18:53:26 +0200, Pedro Alves wrote: > I could reproduce this with 7.7, even. > > This is not a 7.8 regression, but I think it can go in safely to the branch. While I agree it still is a testsuite results regression. [...] > --- a/gdb/nat/i386-dregs.c > +++ b/gdb/nat/i386-dregs.c > @@ -141,6 +141,13 @@ > (1 << (DR_LOCAL_ENABLE_SHIFT + DR_ENABLE_SIZE * (i))); \ > } while (0) > > +/* Locally disable the break/watchpoint in the I'th debug register. */ > +#define I386_DR_LOCAL_DISABLE(state, i) \ > + do { \ > + (state)->dr_control_mirror &= \ > + ~(1 << (DR_LOCAL_ENABLE_SHIFT + DR_ENABLE_SIZE * (i))); \ > + } while (0) > + > /* Globally enable the break/watchpoint in the I'th debug register. */ > #define I386_DR_GLOBAL_ENABLE(state, i) \ > do { \ > @@ -348,6 +355,7 @@ i386_remove_aligned_watchpoint (struct i386_debug_reg_state *state, > CORE_ADDR addr, unsigned len_rw_bits) > { > int i, retval = -1; > + int all_vacant = 1; > > ALL_DEBUG_REGISTERS (i) > { > @@ -360,11 +368,31 @@ i386_remove_aligned_watchpoint (struct i386_debug_reg_state *state, > /* Reset our mirror. */ > state->dr_mirror[i] = 0; > I386_DR_DISABLE (state, i); > + /* Even though not strictly necessary, clear out all > + bits in DR_CONTROL related to this debug register. > + Debug output is clearer when we don't have stale bits > + in place. This also allows the assertion below. */ > + I386_DR_LOCAL_DISABLE (state, i); This is redundant, I386_DR_DISABLE already does both GLOBAL_DISABLE-like and LOCAL_DISABLE-like. > + I386_DR_SET_RW_LEN (state, i, 0); > } > retval = 0; > } > + > + if (!I386_DR_VACANT (state, i)) > + all_vacant = 0; > } > > + if (all_vacant) > + { > + /* Even though not strictly necessary, clear out all of > + DR_CONTROL, so that when we have no debug registers in use, > + we end up with DR_CONTROL == 0. The Linux support relies on > + this for an optimization. Plus, it makes for clearer debug > + output. */ > + state->dr_control_mirror &= ~DR_LOCAL_SLOWDOWN; > + > + gdb_assert (state->dr_control_mirror == 0); > + } > return retval; > } > [...] Thanks, Jan