From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8203 invoked by alias); 5 Dec 2011 17:04:19 -0000 Received: (qmail 8191 invoked by uid 22791); 5 Dec 2011 17:04:18 -0000 X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_WEB,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtaout23.012.net.il (HELO mtaout23.012.net.il) (80.179.55.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 05 Dec 2011 17:04:02 +0000 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0LVQ00K00PNJVK00@a-mtaout23.012.net.il> for gdb-patches@sourceware.org; Mon, 05 Dec 2011 19:03:58 +0200 (IST) Received: from HOME-C4E4A596F7 ([84.228.50.233]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LVQ00KE9Q2JMQA0@a-mtaout23.012.net.il>; Mon, 05 Dec 2011 19:03:56 +0200 (IST) Date: Mon, 05 Dec 2011 17:06:00 -0000 From: Eli Zaretskii Subject: Re: [PATCH] PR threads/10729: x86 hw watchpoints and non-stop mode In-reply-to: <201112051601.59664.pedro@codesourcery.com> To: Pedro Alves Cc: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <83ehwjar41.fsf@gnu.org> References: <201112051601.59664.pedro@codesourcery.com> X-IsSubscribed: yes 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: 2011-12/txt/msg00147.txt.bz2 > From: Pedro Alves > Date: Mon, 5 Dec 2011 16:01:59 +0000 > > On native x86 targets, the desired state of hardware watchpoints is > kept on a local mirror of the inferior's debug registers, and copied > to each thread whenever the mirror changes. If any of the threads > being copied to are currently running, the copying fails with an ugly > error. > > GDBserver solves this by instead only updating the threads' debug > registers prior to resume, and, when the local mirror changes, forcing > a temporary and transparent stop on running threads, so they can > update the debug registers when re-resumed. When deciding whether an > LWP stopped due to a hardware watchpoint or breakpoint, the current > state of the debug registers in the stopping thread is read, rather > than trusting the mirror still mirrors what was last copied to the > thread. > > This patch matches teaches linux-nat.c to do the same as > GDBserver. > > I suspect this change gets rid of a couple of workarounds we had in > place (e.g., i386_stopped_data_address), so I removed them -- > GDBserver didn't have them. No regressions popped up. Be sure to test it with several watchpoints watching the same address, either with different conditions or different types (rwatch vs awatch vs watch), and also with watchpoints that watch regions longer than 4 bytes on IA32 (and similarly on 64-bit hosts).