} while (0)
/* Set in DR7 the RW and LEN fields for the I'th debug register. */
-#define I386_DR_SET_RW_LEN(state, i,rwlen) \
+#define I386_DR_SET_RW_LEN(state, i, rwlen) \
do { \
(state)->dr_control_mirror &= \
~(0x0f << (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))); \
/* Types of operations supported by i386_handle_nonaligned_watchpoint. */
typedef enum { WP_INSERT, WP_REMOVE, WP_COUNT } i386_wp_op_t;
-\f
+
/* Implementation. */
/* Clear the reference counts and forget everything we knew about the
&& !(TARGET_HAS_DR_LEN_8 && len == 8))
|| addr % len != 0)
{
- retval = i386_handle_nonaligned_watchpoint (&local_state, WP_INSERT,
+ retval = i386_handle_nonaligned_watchpoint (&local_state,
+ WP_INSERT,
addr, len, type);
}
else
{
unsigned len_rw = i386_length_and_rw_bits (len, type);
- retval = i386_insert_aligned_watchpoint (&local_state, addr, len_rw);
+ retval = i386_insert_aligned_watchpoint (&local_state,
+ addr, len_rw);
}
if (retval == 0)
&& !(TARGET_HAS_DR_LEN_8 && len == 8))
|| addr % len != 0)
{
- retval = i386_handle_nonaligned_watchpoint (&local_state, WP_REMOVE,
+ retval = i386_handle_nonaligned_watchpoint (&local_state,
+ WP_REMOVE,
addr, len, type);
}
else
{
unsigned len_rw = i386_length_and_rw_bits (len, type);
- retval = i386_remove_aligned_watchpoint (&local_state, addr, len_rw);
+ retval = i386_remove_aligned_watchpoint (&local_state,
+ addr, len_rw);
}
if (retval == 0)
struct i386_dr_low_type i386_dr_low;
-
/* Support for 8-byte wide hw watchpoints. */
#define TARGET_HAS_DR_LEN_8 (i386_dr_low.debug_register_length == 8)
later processors do that automatically. We set these flags for
backwards compatibility. */
#define DR_LOCAL_SLOWDOWN (0x100)
-#define DR_GLOBAL_SLOWDOWN (0x200)
+#define DR_GLOBAL_SLOWDOWN (0x200)
/* Fields reserved by Intel. This includes the GD (General Detect
Enable) flag, which causes a debug exception to be generated when a
/* The I'th debug register is vacant if its Local and Global Enable
bits are reset in the Debug Control register. */
-#define I386_DR_VACANT(state, i) \
+#define I386_DR_VACANT(state, i) \
(((state)->dr_control_mirror & (3 << (DR_ENABLE_SIZE * (i)))) == 0)
/* Locally enable the break/watchpoint in the I'th debug register. */
printf_unfiltered (" (addr=%lx, len=%d, type=%s)",
/* This code is for ia32, so casting CORE_ADDR
to unsigned long should be okay. */
- (unsigned long)addr, len,
+ (unsigned long) addr, len,
type == hw_write ? "data-write"
: (type == hw_read ? "data-read"
: (type == hw_access ? "data-read/write"
printf_unfiltered ("\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_REGISTERS (i)
{
printf_unfiltered ("\
\tDR%d: addr=0x%s, ref.count=%d DR%d: addr=0x%s, ref.count=%d\n",
i, phex (state->dr_mirror[i], addr_size),
state->dr_ref_count[i],
i + 1, phex (state->dr_mirror[i + 1], addr_size),
- state->dr_ref_count[i+1]);
+ state->dr_ref_count[i + 1]);
i++;
}
}
/* 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_REGISTERS (i)
{
if (!I386_DR_VACANT (state, i)
&& state->dr_mirror[i] == addr
}
/* Next, look for a vacant debug register. */
- ALL_DEBUG_REGISTERS(i)
+ ALL_DEBUG_REGISTERS (i)
{
if (I386_DR_VACANT (state, i))
break;
{
int i, retval = -1;
- ALL_DEBUG_REGISTERS(i)
+ ALL_DEBUG_REGISTERS (i)
{
if (!I386_DR_VACANT (state, i)
&& state->dr_mirror[i] == addr
else
internal_error (__FILE__, __LINE__, _("\
Invalid value %d of operation in i386_handle_nonaligned_watchpoint.\n"),
- (int)what);
+ (int) what);
if (retval)
break;
}
if (type == hw_read)
return 1; /* unsupported */
- if (((len != 1 && len !=2 && len !=4) && !(TARGET_HAS_DR_LEN_8 && len == 8))
+ if (((len != 1 && len != 2 && len != 4)
+ && !(TARGET_HAS_DR_LEN_8 && len == 8))
|| addr % len != 0)
- retval = i386_handle_nonaligned_watchpoint (&local_state,
- WP_INSERT, addr, len, type);
+ {
+ retval = i386_handle_nonaligned_watchpoint (&local_state,
+ WP_INSERT,
+ addr, len, type);
+ }
else
{
unsigned len_rw = i386_length_and_rw_bits (len, type);
commit the change back to the inferior. */
struct i386_debug_reg_state local_state = *state;
- if (((len != 1 && len !=2 && len !=4) && !(TARGET_HAS_DR_LEN_8 && len == 8))
+ if (((len != 1 && len != 2 && len != 4)
+ && !(TARGET_HAS_DR_LEN_8 && len == 8))
|| addr % len != 0)
- retval = i386_handle_nonaligned_watchpoint (&local_state,
- WP_REMOVE, addr, len, type);
+ {
+ retval = i386_handle_nonaligned_watchpoint (&local_state,
+ WP_REMOVE,
+ addr, len, type);
+ }
else
{
unsigned len_rw = i386_length_and_rw_bits (len, type);
/* Compute how many aligned watchpoints we would need to cover this
region. */
- nregs = i386_handle_nonaligned_watchpoint (state,
- WP_COUNT, addr, len, hw_write);
+ nregs = i386_handle_nonaligned_watchpoint (state, WP_COUNT,
+ addr, len, hw_write);
return nregs <= DR_NADDR ? 1 : 0;
}
registers. */
status = i386_dr_low.get_status ();
- ALL_DEBUG_REGISTERS(i)
+ ALL_DEBUG_REGISTERS (i)
{
if (!I386_DR_WATCH_HIT (status, i))
continue;
i386_show_dr (state, "watchpoint_hit", addr, -1, hw_write);
}
}
+
if (maint_show_dr && addr == 0)
i386_show_dr (state, "stopped_data_addr", 0, 0, hw_write);