aboutsummaryrefslogtreecommitdiff
path: root/gdb/nat
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2014-09-03 12:05:50 +0100
committerGary Benson <gbenson@redhat.com>2014-09-03 12:40:49 +0100
commit97ea6506c45ab5519483a0221fdc049038496492 (patch)
tree4aeebec2dfe700ec41d33ba803a88dbb7aa33e27 /gdb/nat
parentd14378154883eb1ae5373e7a73edcc9d97e62634 (diff)
downloadbinutils-97ea6506c45ab5519483a0221fdc049038496492.zip
binutils-97ea6506c45ab5519483a0221fdc049038496492.tar.gz
binutils-97ea6506c45ab5519483a0221fdc049038496492.tar.bz2
x86 debug address register clarifications
The loop macro ALL_DEBUG_REGISTERS does not iterate over the status or control registers, so its name is misleading. This commit renames it as ALL_DEBUG_ADDRESS_REGISTERS and updates all uses. This commit also updates its loop conditions to an equivalent but better form, and makes two functions use it that had previously hardwired the loop. A comment on a related field in the x86_debug_reg_state structure is also updated to reflect that the field refers specifically to address registers only. gdb/ChangeLog: * nat/x86-dregs.h (ALL_DEBUG_REGISTERS): Renamed as... (ALL_DEBUG_ADDRESS_REGISTERS): New macro. All uses updated. Loop conditions changed to equivalent form. (struct x86_debug_reg_state): Updated dr_ref_count comment. * x86-linux-nat.c (x86_linux_prepare_to_resume): Use ALL_DEBUG_ADDRESS_REGISTERS. gdb/gdbserver/ChangeLog: * linux-x86-low.c (x86_linux_prepare_to_resume): Use ALL_DEBUG_ADDRESS_REGISTERS.
Diffstat (limited to 'gdb/nat')
-rw-r--r--gdb/nat/x86-dregs.c12
-rw-r--r--gdb/nat/x86-dregs.h7
2 files changed, 10 insertions, 9 deletions
diff --git a/gdb/nat/x86-dregs.c b/gdb/nat/x86-dregs.c
index 5381c77..fbb2426 100644
--- a/gdb/nat/x86-dregs.c
+++ b/gdb/nat/x86-dregs.c
@@ -205,7 +205,7 @@ x86_show_dr (struct x86_debug_reg_state *state,
debug_printf ("\tCONTROL (DR7): %s STATUS (DR6): %s\n",
phex (state->dr_control_mirror, 8),
phex (state->dr_status_mirror, 8));
- ALL_DEBUG_REGISTERS (i)
+ ALL_DEBUG_ADDRESS_REGISTERS (i)
{
debug_printf ("\
\tDR%d: addr=0x%s, ref.count=%d DR%d: addr=0x%s, ref.count=%d\n",
@@ -291,7 +291,7 @@ x86_insert_aligned_watchpoint (struct x86_debug_reg_state *state,
/* First, look for an occupied debug register with the same address
and the same RW and LEN definitions. If we find one, we can
reuse it for this watchpoint as well (and save a register). */
- ALL_DEBUG_REGISTERS (i)
+ ALL_DEBUG_ADDRESS_REGISTERS (i)
{
if (!X86_DR_VACANT (state, i)
&& state->dr_mirror[i] == addr
@@ -303,7 +303,7 @@ x86_insert_aligned_watchpoint (struct x86_debug_reg_state *state,
}
/* Next, look for a vacant debug register. */
- ALL_DEBUG_REGISTERS (i)
+ ALL_DEBUG_ADDRESS_REGISTERS (i)
{
if (X86_DR_VACANT (state, i))
break;
@@ -346,7 +346,7 @@ x86_remove_aligned_watchpoint (struct x86_debug_reg_state *state,
int i, retval = -1;
int all_vacant = 1;
- ALL_DEBUG_REGISTERS (i)
+ ALL_DEBUG_ADDRESS_REGISTERS (i)
{
if (!X86_DR_VACANT (state, i)
&& state->dr_mirror[i] == addr
@@ -461,7 +461,7 @@ x86_update_inferior_debug_regs (struct x86_debug_reg_state *state,
{
int i;
- ALL_DEBUG_REGISTERS (i)
+ ALL_DEBUG_ADDRESS_REGISTERS (i)
{
if (X86_DR_VACANT (new_state, i) != X86_DR_VACANT (state, i))
x86_dr_low_set_addr (new_state, i);
@@ -620,7 +620,7 @@ x86_dr_stopped_data_address (struct x86_debug_reg_state *state,
registers. */
status = x86_dr_low_get_status ();
- ALL_DEBUG_REGISTERS (i)
+ ALL_DEBUG_ADDRESS_REGISTERS (i)
{
if (!X86_DR_WATCH_HIT (status, i))
continue;
diff --git a/gdb/nat/x86-dregs.h b/gdb/nat/x86-dregs.h
index fb179a5..aebcbce 100644
--- a/gdb/nat/x86-dregs.h
+++ b/gdb/nat/x86-dregs.h
@@ -85,12 +85,13 @@ struct x86_debug_reg_state
CORE_ADDR dr_mirror[DR_NADDR];
unsigned dr_status_mirror, dr_control_mirror;
- /* Reference counts for each debug register. */
+ /* Reference counts for each debug address register. */
int dr_ref_count[DR_NADDR];
};
-/* A macro to loop over all debug registers. */
-#define ALL_DEBUG_REGISTERS(i) for (i = 0; i < DR_NADDR; i++)
+/* A macro to loop over all debug address registers. */
+#define ALL_DEBUG_ADDRESS_REGISTERS(i) \
+ for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++)
/* Insert a watchpoint to watch a memory region which starts at
address ADDR and whose length is LEN bytes. Watch memory accesses