aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2014-06-19 11:55:26 +0100
committerGary Benson <gbenson@redhat.com>2014-06-20 13:05:50 +0100
commit42995dbda646ff0291a36f83a7f1a9f45e3fda8a (patch)
tree6d599720b391b49123049a2091d4cab02cfc4660 /gdb/gdbserver
parente1d2394b50c7b174f48e38efb398034d75e67c99 (diff)
downloadbinutils-42995dbda646ff0291a36f83a7f1a9f45e3fda8a.zip
binutils-42995dbda646ff0291a36f83a7f1a9f45e3fda8a.tar.gz
binutils-42995dbda646ff0291a36f83a7f1a9f45e3fda8a.tar.bz2
Vectorize gdbserver x86 debug register accessors
This commit makes gdbserver access the x86 debug register accessor functions via the same function vector as GDB proper. This removes a chunk of conditional code that was previously in i386-{nat,low}.h and leaves a single macro as the only GDB/gdbserver difference in nat/i386-dregs.c. gdb/ 2014-06-20 Gary Benson <gbenson@redhat.com> * i386-nat.h (debug_hw_points): Moved to nat/i386-dregs.c. (i386_dr_low_type): Moved to nat/i386-dregs.h. (i386_dr_low): Likewise. (i386_dr_low_can_set_addr): Moved to nat/i386-dregs.c. (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. * nat/i386-dregs.h (i386_dr_low_type): Moved from i386-nat.h. (i386_dr_low): Likewise. * nat/i386-dregs.c (i386-low.h): Remove include. (i386-nat.h): Likewise. (nat/i386-dregs.h): New include. (i386_dr_low_can_set_addr): Moved from 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. (debug_hw_points): Likewise. gdb/gdbserver/ 2014-06-20 Gary Benson <gbenson@redhat.com> * i386-low.h (i386_dr_low_can_set_addr): Removed. (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. * linux-x86-low.c (i386_dr_low_set_addr): Changed signature. Made static. (i386_dr_low_get_addr): Likewise. (i386_dr_low_set_control): Likewise. (i386_dr_low_get_control): Likewise. (i386_dr_low_get_status): Likewise. (i386_dr_low): New global variable. * win32-i386-low.c (i386_dr_low_set_addr): Changed signature. Made static. (i386_dr_low_get_addr): Likewise. (i386_dr_low_set_control): Likewise. (i386_dr_low_get_control): Likewise. (i386_dr_low_get_status): Likewise. (i386_dr_low): New global variable.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog25
-rw-r--r--gdb/gdbserver/i386-low.h41
-rw-r--r--gdb/gdbserver/linux-x86-low.c25
-rw-r--r--gdb/gdbserver/win32-i386-low.c25
4 files changed, 61 insertions, 55 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 54556f8..cde9c0a 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,28 @@
+2014-06-20 Gary Benson <gbenson@redhat.com>
+
+ * i386-low.h (i386_dr_low_can_set_addr): Removed.
+ (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.
+ * linux-x86-low.c (i386_dr_low_set_addr):
+ Changed signature. Made static.
+ (i386_dr_low_get_addr): Likewise.
+ (i386_dr_low_set_control): Likewise.
+ (i386_dr_low_get_control): Likewise.
+ (i386_dr_low_get_status): Likewise.
+ (i386_dr_low): New global variable.
+ * win32-i386-low.c (i386_dr_low_set_addr):
+ Changed signature. Made static.
+ (i386_dr_low_get_addr): Likewise.
+ (i386_dr_low_set_control): Likewise.
+ (i386_dr_low_get_control): Likewise.
+ (i386_dr_low_get_status): Likewise.
+ (i386_dr_low): New global variable.
+
2014-06-20 Marcus Shawcroft <marcus.shawcroft@arm.com>
* configure.ac: Invoke. AC_CHECK_TOOL(AR, ar).
diff --git a/gdb/gdbserver/i386-low.h b/gdb/gdbserver/i386-low.h
index bad03b9..e726038 100644
--- a/gdb/gdbserver/i386-low.h
+++ b/gdb/gdbserver/i386-low.h
@@ -22,44 +22,3 @@
/* Initialize STATE. */
extern void i386_low_init_dregs (struct i386_debug_reg_state *state);
-
-
-/* Each target needs to provide several low-level functions
- that will be called to insert watchpoints and hardware breakpoints
- into the inferior, remove them, and check their status. These
- functions are:
-
- i386_dr_low_set_control -- set the debug control (DR7)
- register to a given value
-
- i386_dr_low_set_addr -- put an address into one debug register
-
- i386_dr_low_get_status -- return the value of the debug
- 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);
-
-/* 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);
-
-/* Return the value of the inferior's DR7 debug control register. */
-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/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index b8a0006..94451da 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -587,8 +587,8 @@ update_debug_registers_callback (struct inferior_list_entry *entry,
/* Update the inferior's debug register REGNUM from STATE. */
-void
-i386_dr_low_set_addr (const struct i386_debug_reg_state *state, int regnum)
+static void
+i386_dr_low_set_addr (int regnum, CORE_ADDR addr)
{
/* Only update the threads of this process. */
int pid = pid_of (current_inferior);
@@ -601,7 +601,7 @@ i386_dr_low_set_addr (const struct i386_debug_reg_state *state, int regnum)
/* Return the inferior's debug register REGNUM. */
-CORE_ADDR
+static CORE_ADDR
i386_dr_low_get_addr (int regnum)
{
ptid_t ptid = ptid_of (current_inferior);
@@ -614,8 +614,8 @@ i386_dr_low_get_addr (int regnum)
/* Update the inferior's DR7 debug control register from STATE. */
-void
-i386_dr_low_set_control (const struct i386_debug_reg_state *state)
+static void
+i386_dr_low_set_control (unsigned long control)
{
/* Only update the threads of this process. */
int pid = pid_of (current_inferior);
@@ -625,7 +625,7 @@ i386_dr_low_set_control (const struct i386_debug_reg_state *state)
/* Return the inferior's DR7 debug control register. */
-unsigned
+static unsigned long
i386_dr_low_get_control (void)
{
ptid_t ptid = ptid_of (current_inferior);
@@ -636,13 +636,24 @@ i386_dr_low_get_control (void)
/* Get the value of the DR6 debug status register from the inferior
and record it in STATE. */
-unsigned
+static unsigned long
i386_dr_low_get_status (void)
{
ptid_t ptid = ptid_of (current_inferior);
return x86_linux_dr_get (ptid, DR_STATUS);
}
+
+/* Low-level function vector. */
+struct i386_dr_low_type i386_dr_low =
+ {
+ i386_dr_low_set_control,
+ i386_dr_low_set_addr,
+ i386_dr_low_get_addr,
+ i386_dr_low_get_status,
+ i386_dr_low_get_control,
+ sizeof (void *),
+ };
/* Breakpoint/Watchpoint support. */
diff --git a/gdb/gdbserver/win32-i386-low.c b/gdb/gdbserver/win32-i386-low.c
index 09160dd..e894677 100644
--- a/gdb/gdbserver/win32-i386-low.c
+++ b/gdb/gdbserver/win32-i386-low.c
@@ -45,8 +45,8 @@ static int debug_registers_used = 0;
/* Update the inferior's debug register REGNUM from STATE. */
-void
-i386_dr_low_set_addr (const struct i386_debug_reg_state *state, int regnum)
+static void
+i386_dr_low_set_addr (int regnum, CORE_ADDR addr)
{
if (! (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR))
fatal ("Invalid debug register %d", regnum);
@@ -58,7 +58,7 @@ i386_dr_low_set_addr (const struct i386_debug_reg_state *state, int regnum)
debug_registers_used = 1;
}
-CORE_ADDR
+static CORE_ADDR
i386_dr_low_get_addr (int regnum)
{
gdb_assert (DR_FIRSTADDR <= regnum && regnum <= DR_LASTADDR);
@@ -68,8 +68,8 @@ i386_dr_low_get_addr (int regnum)
/* Update the inferior's DR7 debug control register from STATE. */
-void
-i386_dr_low_set_control (const struct i386_debug_reg_state *state)
+static void
+i386_dr_low_set_control (unsigned long control)
{
/* debug_reg_state.dr_control_mirror is already set.
Just notify i386_set_thread_context, i386_thread_added
@@ -78,7 +78,7 @@ i386_dr_low_set_control (const struct i386_debug_reg_state *state)
debug_registers_used = 1;
}
-unsigned
+static unsigned long
i386_dr_low_get_control (void)
{
return debug_reg_state.dr_control_mirror;
@@ -87,7 +87,7 @@ i386_dr_low_get_control (void)
/* Get the value of the DR6 debug status register from the inferior
and record it in STATE. */
-unsigned
+static unsigned long
i386_dr_low_get_status (void)
{
/* We don't need to do anything here, the last call to thread_rec for
@@ -95,6 +95,17 @@ i386_dr_low_get_status (void)
return debug_reg_state.dr_status_mirror;
}
+/* Low-level function vector. */
+struct i386_dr_low_type i386_dr_low =
+ {
+ i386_dr_low_set_control,
+ i386_dr_low_set_addr,
+ i386_dr_low_get_addr,
+ i386_dr_low_get_status,
+ i386_dr_low_get_control,
+ sizeof (void *),
+ };
+
/* Breakpoint/watchpoint support. */
static int