From patchwork Wed Jun 18 15:22:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Benson X-Patchwork-Id: 1560 Received: (qmail 8959 invoked by alias); 18 Jun 2014 15:23:08 -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 8826 invoked by uid 89); 18 Jun 2014 15:23:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 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; Wed, 18 Jun 2014 15:23:05 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5IFN333018119 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 18 Jun 2014 11:23:04 -0400 Received: from blade.nx (ovpn-116-59.ams2.redhat.com [10.36.116.59]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5IFN2gF020515 for ; Wed, 18 Jun 2014 11:23:03 -0400 Received: from blade.nx (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id 2660426249D for ; Wed, 18 Jun 2014 16:23:02 +0100 (BST) From: Gary Benson To: gdb-patches@sourceware.org Subject: [PATCH 4/4 v2] Directly call i386-dregs functions Date: Wed, 18 Jun 2014 16:22:56 +0100 Message-Id: <1403104976-2492-5-git-send-email-gbenson@redhat.com> In-Reply-To: <1403104976-2492-1-git-send-email-gbenson@redhat.com> References: <1403104976-2492-1-git-send-email-gbenson@redhat.com> X-IsSubscribed: yes Three target_ops functions in i386-nat.c call other local target_ops functions. This commit changes those functions to call the functions in i386-dregs.c directly. gdb/ 2014-06-18 Gary Benson * i386-nat.c (i386_stopped_by_watchpoint): Use i386_dr_stopped_by_watchpoint. (i386_insert_hw_breakpoint): Use i386_dr_insert_watchpoint. (i386_remove_hw_breakpoint): Use i386_dr_remove_watchpoint. --- gdb/ChangeLog | 7 +++++++ gdb/i386-nat.c | 20 ++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c index 750b878..499fffb 100644 --- a/gdb/i386-nat.c +++ b/gdb/i386-nat.c @@ -208,8 +208,10 @@ i386_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p) static int i386_stopped_by_watchpoint (struct target_ops *ops) { - CORE_ADDR addr = 0; - return i386_stopped_data_address (ops, &addr); + struct i386_debug_reg_state *state + = i386_debug_reg_state (ptid_get_pid (inferior_ptid)); + + return i386_dr_stopped_by_watchpoint (state); } /* Insert a hardware-assisted breakpoint at BP_TGT->placed_address. @@ -219,8 +221,11 @@ static int i386_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { - return i386_insert_watchpoint (self, bp_tgt->placed_address, 1, - hw_execute, NULL) ? EBUSY : 0; + struct i386_debug_reg_state *state + = i386_debug_reg_state (ptid_get_pid (inferior_ptid)); + + return i386_dr_insert_watchpoint (state, hw_execute, + bp_tgt->placed_address, 1) ? EBUSY : 0; } /* Remove a hardware-assisted breakpoint at BP_TGT->placed_address. @@ -230,8 +235,11 @@ static int i386_remove_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { - return i386_remove_watchpoint (self, bp_tgt->placed_address, 1, - hw_execute, NULL); + struct i386_debug_reg_state *state + = i386_debug_reg_state (ptid_get_pid (inferior_ptid)); + + return i386_dr_remove_watchpoint (state, hw_execute, + bp_tgt->placed_address, 1); } /* Returns the number of hardware watchpoints of type TYPE that we can