From patchwork Tue Jun 17 14:12: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: 1530 Received: (qmail 29384 invoked by alias); 17 Jun 2014 14:58:24 -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 29365 invoked by uid 89); 17 Jun 2014 14:58:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS 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 ESMTP; Tue, 17 Jun 2014 14:58:22 +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 s5HED8rw000957 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 17 Jun 2014 10:13:08 -0400 Received: from blade.nx (ovpn-116-59.ams2.redhat.com [10.36.116.59]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5HED6ZO029342 for ; Tue, 17 Jun 2014 10:13:07 -0400 Received: from blade.nx (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id 2879A262488 for ; Tue, 17 Jun 2014 15:13:05 +0100 (BST) From: Gary Benson To: gdb-patches@sourceware.org Subject: [PATCH 13/15] Move macros from i386-{nat, low}.c to i386-{nat, low}.h Date: Tue, 17 Jun 2014 15:12:56 +0100 Message-Id: <1403014378-4349-14-git-send-email-gbenson@redhat.com> In-Reply-To: <1403014378-4349-1-git-send-email-gbenson@redhat.com> References: <1403014378-4349-1-git-send-email-gbenson@redhat.com> X-IsSubscribed: yes This commit moves macros required by the soon-to-be-created nat/i386-dregs.c into i386-{nat,low}.h. gdb/ 2014-06-17 Gary Benson * i386-nat.h (i386_dr_low_can_set_addr): New macro. (i386_dr_low_set_addr): Likewise. (i386_dr_low_get_addr): Likewise. (i386_dr_low_can_set_control): Likewise. (i386_dr_low_set_control): Likewise. (i386_dr_low_get_control): Likewise. (i386_dr_low_get_status): Likewise. (i386_get_debug_register_length): Likewise. * i386-nat.c (i386_dr_low_can_set_addr): Now in i386-nat.h. (i386_dr_low_set_addr): Likewise. (i386_dr_low_get_addr): Likewise. (i386_dr_low_can_set_control): Likewise. (i386_dr_low_set_control): Likewise. (i386_dr_low_get_control): Likewise. (i386_dr_low_get_status): Likewise. (i386_get_debug_register_length): Likewise. gdb/gdbserver/ 2014-06-17 Gary Benson * i386-low.h (i386_dr_low_can_set_addr): New macro. (i386_dr_low_can_set_control): Likewise. (i386_get_debug_register_length): Likewise. * i386-low.c (i386_dr_low_can_set_addr): Now in i386-low.h. (i386_dr_low_can_set_control): Likewise. (i386_get_debug_register_length): Likewise. --- gdb/ChangeLog | 19 +++++++++++++++++++ gdb/gdbserver/ChangeLog | 9 +++++++++ gdb/gdbserver/i386-low.c | 7 ------- gdb/gdbserver/i386-low.h | 10 ++++++++++ gdb/i386-nat.c | 17 ----------------- gdb/i386-nat.h | 27 +++++++++++++++++++++++++++ 6 files changed, 65 insertions(+), 24 deletions(-) diff --git a/gdb/gdbserver/i386-low.c b/gdb/gdbserver/i386-low.c index bd25694..5333819 100644 --- a/gdb/gdbserver/i386-low.c +++ b/gdb/gdbserver/i386-low.c @@ -32,13 +32,6 @@ The functions below implement debug registers sharing by reference counts, and allow to watch regions up to 16 bytes long. */ -#define i386_dr_low_can_set_addr() 1 -#define i386_dr_low_can_set_control() 1 - -/* Debug register size, in bytes. */ -/* NOTE: sizeof (long) == 4 on win64. */ -#define i386_get_debug_register_length() (sizeof (void *)) - /* Support for 8-byte wide hw watchpoints. */ #define TARGET_HAS_DR_LEN_8 (i386_get_debug_register_length () == 8) diff --git a/gdb/gdbserver/i386-low.h b/gdb/gdbserver/i386-low.h index 71f7c32..bad03b9 100644 --- a/gdb/gdbserver/i386-low.h +++ b/gdb/gdbserver/i386-low.h @@ -38,6 +38,9 @@ extern void i386_low_init_dregs (struct i386_debug_reg_state *state); status (DR6) register. */ +/* Can we update the inferior's debug registers? */ +#define i386_dr_low_can_set_addr() 1 + /* Update the inferior's debug register REGNUM from STATE. */ extern void i386_dr_low_set_addr (const struct i386_debug_reg_state *state, int regnum); @@ -45,6 +48,9 @@ extern void i386_dr_low_set_addr (const struct i386_debug_reg_state *state, /* Return the inferior's debug register REGNUM. */ extern CORE_ADDR i386_dr_low_get_addr (int regnum); +/* Can we update the inferior's DR7 control register? */ +#define i386_dr_low_can_set_control() 1 + /* Update the inferior's DR7 debug control register from STATE. */ extern void i386_dr_low_set_control (const struct i386_debug_reg_state *state); @@ -53,3 +59,7 @@ extern unsigned i386_dr_low_get_control (void); /* Return the value of the inferior's DR6 debug status register. */ extern unsigned i386_dr_low_get_status (void); + +/* Return the debug register size, in bytes. */ +/* Note that sizeof (long) == 4 on win64. */ +#define i386_get_debug_register_length() (sizeof (void *)) diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c index 1dfa9ee..1f7b70c 100644 --- a/gdb/i386-nat.c +++ b/gdb/i386-nat.c @@ -47,23 +47,6 @@ static int debug_hw_points; /* Low-level function vector. */ struct i386_dr_low_type i386_dr_low; -#define i386_dr_low_can_set_addr() (i386_dr_low.set_addr != NULL) -#define i386_dr_low_can_set_control() (i386_dr_low.set_control != NULL) - -#define i386_dr_low_set_addr(new_state, i) \ - (i386_dr_low.set_addr ((i), (new_state)->dr_mirror[(i)])) - -#define i386_dr_low_set_control(new_state) \ - (i386_dr_low.set_control ((new_state)->dr_control_mirror)) - -#define i386_dr_low_get_addr(i) (i386_dr_low.get_addr ((i))) -#define i386_dr_low_get_status() (i386_dr_low.get_status ()) -#define i386_dr_low_get_control() (i386_dr_low.get_control ()) - -/* Debug register size, in bytes. */ -#define i386_get_debug_register_length() \ - (i386_dr_low.debug_register_length) - /* Support for 8-byte wide hw watchpoints. */ #define TARGET_HAS_DR_LEN_8 (i386_get_debug_register_length () == 8) diff --git a/gdb/i386-nat.h b/gdb/i386-nat.h index 1f4130c..f20b013 100644 --- a/gdb/i386-nat.h +++ b/gdb/i386-nat.h @@ -73,6 +73,33 @@ struct i386_dr_low_type extern struct i386_dr_low_type i386_dr_low; +/* Can we update the inferior's debug registers? */ +#define i386_dr_low_can_set_addr() (i386_dr_low.set_addr != NULL) + +/* Update the inferior's debug register REGNUM from STATE. */ +#define i386_dr_low_set_addr(new_state, i) \ + (i386_dr_low.set_addr ((i), (new_state)->dr_mirror[(i)])) + +/* Return the inferior's debug register REGNUM. */ +#define i386_dr_low_get_addr(i) (i386_dr_low.get_addr ((i))) + +/* Can we update the inferior's DR7 control register? */ +#define i386_dr_low_can_set_control() (i386_dr_low.set_control != NULL) + +/* Update the inferior's DR7 debug control register from STATE. */ +#define i386_dr_low_set_control(new_state) \ + (i386_dr_low.set_control ((new_state)->dr_control_mirror)) + +/* Return the value of the inferior's DR7 debug control register. */ +#define i386_dr_low_get_control() (i386_dr_low.get_control ()) + +/* Return the value of the inferior's DR6 debug status register. */ +#define i386_dr_low_get_status() (i386_dr_low.get_status ()) + +/* Return the debug register size, in bytes. */ +#define i386_get_debug_register_length() \ + (i386_dr_low.debug_register_length) + /* Use this function to set i386_dr_low debug_register_length field rather than setting it directly to check that the length is only set once. It also enables the 'maint set/show show-debug-regs'