From patchwork Fri Jun 27 09:10:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Benson X-Patchwork-Id: 1785 Received: (qmail 11236 invoked by alias); 27 Jun 2014 09:26:25 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 11224 invoked by uid 89); 27 Jun 2014 09:26:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.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; Fri, 27 Jun 2014 09:26:24 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5R9AQ6G024450 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 27 Jun 2014 05:10:26 -0400 Received: from blade.nx (ovpn-116-77.ams2.redhat.com [10.36.116.77]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5R9AOXF008912 for ; Fri, 27 Jun 2014 05:10:25 -0400 Received: from blade.nx (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id D43B52640C0 for ; Fri, 27 Jun 2014 10:10:21 +0100 (BST) From: Gary Benson To: gdb-patches@sourceware.org Subject: [PATCH 5/7] Comment and whitespace changes Date: Fri, 27 Jun 2014 10:10:07 +0100 Message-Id: <1403860209-475-6-git-send-email-gbenson@redhat.com> In-Reply-To: <1403860209-475-1-git-send-email-gbenson@redhat.com> References: <1403860209-475-1-git-send-email-gbenson@redhat.com> X-IsSubscribed: yes This commit merges the comments and whitespace in the common parts of i386-linux-nat.c and amd64-linux-nat.c. gdb/ 2014-06-27 Gary Benson * amd64-linux-nat.c: Comment and whitespace changes. * i386-linux-nat.c: Comment and whitespace changes. --- gdb/ChangeLog | 5 +++++ gdb/amd64-linux-nat.c | 3 +++ gdb/i386-linux-nat.c | 15 ++++++++++++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c index 2aabf37..46b9fa0 100644 --- a/gdb/amd64-linux-nat.c +++ b/gdb/amd64-linux-nat.c @@ -277,8 +277,11 @@ amd64_linux_store_inferior_registers (struct target_ops *ops, } } + /* Support for debug registers. */ +/* Get debug register REGNUM value from only the one LWP of PTID. */ + static unsigned long x86_linux_dr_get (ptid_t ptid, int regnum) { diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index e4ae160..200c621 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -732,7 +732,7 @@ update_debug_registers_callback (struct lwp_info *lwp, void *arg) return 0; } -/* Set DR_CONTROL to ADDR in all LWPs of the current inferior. */ +/* Set DR_CONTROL to CONTROL in all LWPs of the current inferior. */ static void x86_linux_dr_set_control (unsigned long control) @@ -775,9 +775,16 @@ x86_linux_prepare_to_resume (struct lwp_info *lwp) = i386_debug_reg_state (ptid_get_pid (lwp->ptid)); int i; - /* See amd64_linux_prepare_to_resume for Linux kernel note on - i386_linux_dr_set calls ordering. */ + /* On Linux kernel before 2.6.33 commit + 72f674d203cd230426437cdcf7dd6f681dad8b0d + if you enable a breakpoint by the DR_CONTROL bits you need to have + already written the corresponding DR_FIRSTADDR...DR_LASTADDR registers. + Ensure DR_CONTROL gets written as the very last register here. */ + + /* Clear DR_CONTROL first. In some cases, setting DR0-3 to a + value that doesn't match what is enabled in DR_CONTROL + results in EINVAL. */ x86_linux_dr_set (lwp->ptid, DR_CONTROL, 0); for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++) @@ -792,6 +799,8 @@ x86_linux_prepare_to_resume (struct lwp_info *lwp) clear_status = 1; } + /* If DR_CONTROL is supposed to be zero, we've already set it + above. */ if (state->dr_control_mirror != 0) x86_linux_dr_set (lwp->ptid, DR_CONTROL, state->dr_control_mirror);