aboutsummaryrefslogtreecommitdiff
path: root/gdb/i386-nat.c
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2014-06-16 15:06:09 +0100
committerGary Benson <gbenson@redhat.com>2014-06-18 10:15:25 +0100
commit131aa0d4fe4126c53dcb3a73217a39578b73f2ea (patch)
tree56c0a0764acdf959a3f4dce7de0295a16b5b6734 /gdb/i386-nat.c
parentd9305f7fef566159dd940a11155107407f43ec15 (diff)
downloadgdb-131aa0d4fe4126c53dcb3a73217a39578b73f2ea.zip
gdb-131aa0d4fe4126c53dcb3a73217a39578b73f2ea.tar.gz
gdb-131aa0d4fe4126c53dcb3a73217a39578b73f2ea.tar.bz2
Abstract i386_dr_low access
This commit adds macros to abstract access to the i386_dr_low function vector used by i386-nat.c. The macros are named so as to match the names of the functions that do the same work in gdbserver. gdb/ 2014-06-18 Gary Benson <gbenson@redhat.com> * i386-nat.c (i386_dr_low_can_set_addr): New macro. (i386_dr_low_can_set_control): Likewise. (i386_dr_low_set_addr): Likewise. (i386_dr_low_set_control): Likewise. (i386_dr_low_get_addr): Likewise. (i386_dr_low_get_status): Likewise. (i386_dr_low_get_control): Likewise. (i386_insert_aligned_watchpoint): Use new macros. (i386_update_inferior_debug_regs): Likewise. (i386_stopped_data_address): Likewise. gdb/gdbserver/ 2014-06-18 Gary Benson <gbenson@redhat.com> * i386-low.c (i386_dr_low_can_set_addr): New macro. (i386_dr_low_can_set_control): Likewise. (i386_insert_aligned_watchpoint): New check.
Diffstat (limited to 'gdb/i386-nat.c')
-rw-r--r--gdb/i386-nat.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c
index a64cdab..4282535 100644
--- a/gdb/i386-nat.c
+++ b/gdb/i386-nat.c
@@ -47,6 +47,19 @@ 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)
@@ -379,7 +392,7 @@ i386_insert_aligned_watchpoint (struct i386_debug_reg_state *state,
{
int i;
- if (!i386_dr_low.set_addr || !i386_dr_low.set_control)
+ if (!i386_dr_low_can_set_addr () || !i386_dr_low_can_set_control ())
return -1;
/* First, look for an occupied debug register with the same address
@@ -538,13 +551,13 @@ i386_update_inferior_debug_regs (struct i386_debug_reg_state *state,
ALL_DEBUG_REGISTERS (i)
{
if (I386_DR_VACANT (new_state, i) != I386_DR_VACANT (state, i))
- i386_dr_low.set_addr (i, new_state->dr_mirror[i]);
+ i386_dr_low_set_addr (new_state, i);
else
gdb_assert (new_state->dr_mirror[i] == state->dr_mirror[i]);
}
if (new_state->dr_control_mirror != state->dr_control_mirror)
- i386_dr_low.set_control (new_state->dr_control_mirror);
+ i386_dr_low_set_control (new_state);
*state = *new_state;
}
@@ -698,7 +711,7 @@ i386_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
was running when we last changed watchpoints, the mirror no
longer represents what was set in this thread's debug
registers. */
- status = i386_dr_low.get_status ();
+ status = i386_dr_low_get_status ();
ALL_DEBUG_REGISTERS (i)
{
@@ -707,7 +720,7 @@ i386_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
if (!control_p)
{
- control = i386_dr_low.get_control ();
+ control = i386_dr_low_get_control ();
control_p = 1;
}
@@ -718,7 +731,7 @@ i386_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
paranoiac. */
if (I386_DR_GET_RW_LEN (control, i) != 0)
{
- addr = i386_dr_low.get_addr (i);
+ addr = i386_dr_low_get_addr (i);
rc = 1;
if (debug_hw_points)
i386_show_dr (state, "watchpoint_hit", addr, -1, hw_write);