From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9649 invoked by alias); 12 Dec 2011 20:30:44 -0000 Received: (qmail 9637 invoked by uid 22791); 12 Dec 2011 20:30:43 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 12 Dec 2011 20:30:30 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1RaCW5-0000UD-Ka from pedro_alves@mentor.com ; Mon, 12 Dec 2011 12:30:29 -0800 Received: from scottsdale.localnet ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 12 Dec 2011 20:30:27 +0000 From: Pedro Alves To: Jan Kratochvil Subject: Re: [PATCH] PR threads/10729: x86 hw watchpoints and non-stop mode Date: Mon, 12 Dec 2011 20:34:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-13-generic; KDE/4.7.2; x86_64; ; ) Cc: gdb-patches@sourceware.org References: <201112051601.59664.pedro@codesourcery.com> <20111212172238.GA7737@host2.jankratochvil.net> <20111212183734.GA24356@host2.jankratochvil.net> In-Reply-To: <20111212183734.GA24356@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201112122030.25365.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/msg00354.txt.bz2 Thanks again for the test. I'm wondering why bother to mask out DR_STATUS bits instead of clearing all of it. I mean, when we set a watchpoint, we're already clobbering the whole of DR_CONTROL, with i386_dr_low.set_control (new_state->dr_control_mirror); so it seems there's no point in trying to retain all the other bits of DR_STATUS. If we set a watchpoint, any change the inferior had done itself to the debug registers is thrown out the window. If I change amd64_linux_prepare_to_resume to look like: static void amd64_linux_prepare_to_resume (struct lwp_info *lwp) { int clear_status = 0; if (lwp->arch_private->debug_registers_changed) { struct i386_debug_reg_state *state = i386_debug_reg_state (); int i; for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++) if (state->dr_ref_count[i] > 0) { amd64_linux_dr_set (lwp->ptid, i, state->dr_mirror[i]); /* Only a sanity check for leftover bits (set possibly only by inferior). */ clear_status = 1; } amd64_linux_dr_set (lwp->ptid, DR_CONTROL, state->dr_control_mirror); lwp->arch_private->debug_registers_changed = 0; } if (clear_status || lwp->stopped_by_watchpoint) amd64_linux_dr_set (lwp->ptid, DR_STATUS, 0); } (the `clear_status' bits are new) then the new test passes. I'm doing a full run with this now. -- Pedro Alves