mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-26 22:07:58 +08:00
Comment changes
This commit fixes various comment differences between i386-nat.[ch] and i386-low.[ch]. gdb/ 2014-06-18 Gary Benson <gbenson@redhat.com> * i386-nat.c: Comment changes. gdb/gdbserver/ 2014-06-18 Gary Benson <gbenson@redhat.com> * i386-low.h: Comment changes. * i386-low.c: Likewise.
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
2014-06-18 Gary Benson <gbenson@redhat.com>
|
||||||
|
|
||||||
|
* i386-nat.c: Comment changes.
|
||||||
|
|
||||||
2014-06-18 Gary Benson <gbenson@redhat.com>
|
2014-06-18 Gary Benson <gbenson@redhat.com>
|
||||||
|
|
||||||
* i386-nat.c (I386_DR_WATCH_MASK): Remove macro.
|
* i386-nat.c (I386_DR_WATCH_MASK): Remove macro.
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2014-06-18 Gary Benson <gbenson@redhat.com>
|
||||||
|
|
||||||
|
* i386-low.h: Comment changes.
|
||||||
|
* i386-low.c: Likewise.
|
||||||
|
|
||||||
2014-06-18 Gary Benson <gbenson@redhat.com>
|
2014-06-18 Gary Benson <gbenson@redhat.com>
|
||||||
|
|
||||||
* i386-low.c: Whitespace changes.
|
* i386-low.c: Whitespace changes.
|
||||||
|
@ -21,6 +21,17 @@
|
|||||||
#include "target.h"
|
#include "target.h"
|
||||||
#include "i386-low.h"
|
#include "i386-low.h"
|
||||||
|
|
||||||
|
/* Support for hardware watchpoints and breakpoints using the i386
|
||||||
|
debug registers.
|
||||||
|
|
||||||
|
This provides several functions for inserting and removing
|
||||||
|
hardware-assisted breakpoints and watchpoints, testing if one or
|
||||||
|
more of the watchpoints triggered and at what address, checking
|
||||||
|
whether a given region can be watched, etc.
|
||||||
|
|
||||||
|
The functions below implement debug registers sharing by reference
|
||||||
|
counts, and allow to watch regions up to 16 bytes long. */
|
||||||
|
|
||||||
/* Support for 8-byte wide hw watchpoints. */
|
/* Support for 8-byte wide hw watchpoints. */
|
||||||
#ifndef TARGET_HAS_DR_LEN_8
|
#ifndef TARGET_HAS_DR_LEN_8
|
||||||
/* NOTE: sizeof (long) == 4 on win64. */
|
/* NOTE: sizeof (long) == 4 on win64. */
|
||||||
@ -156,8 +167,7 @@ i386_low_init_dregs (struct i386_debug_reg_state *state)
|
|||||||
state->dr_status_mirror = 0;
|
state->dr_status_mirror = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print the values of the mirrored debug registers. This is enabled via
|
/* Print the values of the mirrored debug registers. */
|
||||||
the "set debug-hw-points 1" monitor command. */
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
i386_show_dr (struct i386_debug_reg_state *state,
|
i386_show_dr (struct i386_debug_reg_state *state,
|
||||||
@ -427,7 +437,7 @@ i386_update_inferior_debug_regs (struct i386_debug_reg_state *inf_state,
|
|||||||
|
|
||||||
/* Insert a watchpoint to watch a memory region which starts at
|
/* Insert a watchpoint to watch a memory region which starts at
|
||||||
address ADDR and whose length is LEN bytes. Watch memory accesses
|
address ADDR and whose length is LEN bytes. Watch memory accesses
|
||||||
of the type TYPE_FROM_PACKET. Return 0 on success, -1 on failure. */
|
of the type TYPE. Return 0 on success, -1 on failure. */
|
||||||
|
|
||||||
int
|
int
|
||||||
i386_low_insert_watchpoint (struct i386_debug_reg_state *state,
|
i386_low_insert_watchpoint (struct i386_debug_reg_state *state,
|
||||||
@ -523,8 +533,8 @@ i386_low_region_ok_for_watchpoint (struct i386_debug_reg_state *state,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If the inferior has some break/watchpoint that triggered, set the
|
/* If the inferior has some break/watchpoint that triggered, set the
|
||||||
address associated with that break/watchpoint and return true.
|
address associated with that break/watchpoint and return non-zero.
|
||||||
Otherwise, return false. */
|
Otherwise, return zero. */
|
||||||
|
|
||||||
int
|
int
|
||||||
i386_low_stopped_data_address (struct i386_debug_reg_state *state,
|
i386_low_stopped_data_address (struct i386_debug_reg_state *state,
|
||||||
@ -603,8 +613,8 @@ i386_low_stopped_data_address (struct i386_debug_reg_state *state,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return true if the inferior has some watchpoint that triggered.
|
/* Return non-zero if the inferior has some watchpoint that triggered.
|
||||||
Otherwise return false. */
|
Otherwise return zero. */
|
||||||
|
|
||||||
int
|
int
|
||||||
i386_low_stopped_by_watchpoint (struct i386_debug_reg_state *state)
|
i386_low_stopped_by_watchpoint (struct i386_debug_reg_state *state)
|
||||||
|
@ -33,8 +33,8 @@
|
|||||||
#define DR_FIRSTADDR 0
|
#define DR_FIRSTADDR 0
|
||||||
#define DR_LASTADDR 3
|
#define DR_LASTADDR 3
|
||||||
#define DR_NADDR 4 /* The number of debug address registers. */
|
#define DR_NADDR 4 /* The number of debug address registers. */
|
||||||
#define DR_STATUS 6
|
#define DR_STATUS 6 /* Index of debug status register (DR6). */
|
||||||
#define DR_CONTROL 7
|
#define DR_CONTROL 7 /* Index of debug control register (DR7). */
|
||||||
|
|
||||||
/* Global state needed to track h/w watchpoints. */
|
/* Global state needed to track h/w watchpoints. */
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
The functions below implement debug registers sharing by reference
|
The functions below implement debug registers sharing by reference
|
||||||
counts, and allow to watch regions up to 16 bytes long. */
|
counts, and allow to watch regions up to 16 bytes long. */
|
||||||
|
|
||||||
|
/* Low-level function vector. */
|
||||||
struct i386_dr_low_type i386_dr_low;
|
struct i386_dr_low_type i386_dr_low;
|
||||||
|
|
||||||
/* Support for 8-byte wide hw watchpoints. */
|
/* Support for 8-byte wide hw watchpoints. */
|
||||||
@ -265,9 +266,7 @@ i386_cleanup_dregs (void)
|
|||||||
i386_forget_process (ptid_get_pid (inferior_ptid));
|
i386_forget_process (ptid_get_pid (inferior_ptid));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print the values of the mirrored debug registers. This is called
|
/* Print the values of the mirrored debug registers. */
|
||||||
when maint_show_dr is non-zero. To set that up, type "maint
|
|
||||||
show-debug-regs" at GDB's prompt. */
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
i386_show_dr (struct i386_debug_reg_state *state,
|
i386_show_dr (struct i386_debug_reg_state *state,
|
||||||
@ -439,7 +438,7 @@ i386_remove_aligned_watchpoint (struct i386_debug_reg_state *state,
|
|||||||
&& state->dr_mirror[i] == addr
|
&& state->dr_mirror[i] == addr
|
||||||
&& I386_DR_GET_RW_LEN (state->dr_control_mirror, i) == len_rw_bits)
|
&& I386_DR_GET_RW_LEN (state->dr_control_mirror, i) == len_rw_bits)
|
||||||
{
|
{
|
||||||
if (--state->dr_ref_count[i] == 0) /* no longer in use? */
|
if (--state->dr_ref_count[i] == 0) /* No longer in use? */
|
||||||
{
|
{
|
||||||
/* Reset our mirror. */
|
/* Reset our mirror. */
|
||||||
state->dr_mirror[i] = 0;
|
state->dr_mirror[i] = 0;
|
||||||
@ -646,8 +645,8 @@ i386_region_ok_for_watchpoint (struct target_ops *self,
|
|||||||
return nregs <= DR_NADDR ? 1 : 0;
|
return nregs <= DR_NADDR ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the inferior has some watchpoint that triggered, set the
|
/* If the inferior has some break/watchpoint that triggered, set the
|
||||||
address associated with that watchpoint and return non-zero.
|
address associated with that break/watchpoint and return non-zero.
|
||||||
Otherwise, return zero. */
|
Otherwise, return zero. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -668,24 +667,25 @@ i386_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
|
|||||||
unsigned control = 0;
|
unsigned control = 0;
|
||||||
|
|
||||||
/* In non-stop/async, threads can be running while we change the
|
/* In non-stop/async, threads can be running while we change the
|
||||||
STATE (and friends). Say, we set a watchpoint, and let threads
|
global dr_mirror (and friends). Say, we set a watchpoint, and
|
||||||
resume. Now, say you delete the watchpoint, or add/remove
|
let threads resume. Now, say you delete the watchpoint, or
|
||||||
watchpoints such that STATE changes while threads are running.
|
add/remove watchpoints such that dr_mirror changes while threads
|
||||||
On targets that support non-stop, inserting/deleting watchpoints
|
are running. On targets that support non-stop,
|
||||||
updates the STATE only. It does not update the real thread's
|
inserting/deleting watchpoints updates the global dr_mirror only.
|
||||||
debug registers; that's only done prior to resume. Instead, if
|
It does not update the real thread's debug registers; that's only
|
||||||
threads are running when the mirror changes, a temporary and
|
done prior to resume. Instead, if threads are running when the
|
||||||
transparent stop on all threads is forced so they can get their
|
mirror changes, a temporary and transparent stop on all threads
|
||||||
copy of the debug registers updated on re-resume. Now, say,
|
is forced so they can get their copy of the debug registers
|
||||||
a thread hit a watchpoint before having been updated with the new
|
updated on re-resume. Now, say, a thread hit a watchpoint before
|
||||||
STATE contents, and we haven't yet handled the corresponding
|
having been updated with the new dr_mirror contents, and we
|
||||||
SIGTRAP. If we trusted STATE below, we'd mistake the real
|
haven't yet handled the corresponding SIGTRAP. If we trusted
|
||||||
trapped address (from the last time we had updated debug
|
dr_mirror below, we'd mistake the real trapped address (from the
|
||||||
registers in the thread) with whatever was currently in STATE.
|
last time we had updated debug registers in the thread) with
|
||||||
So to fix this, STATE always represents intention, what we _want_
|
whatever was currently in dr_mirror. So to fix this, dr_mirror
|
||||||
threads to have in debug registers. To get at the address and
|
always represents intention, what we _want_ threads to have in
|
||||||
cause of the trap, we need to read the state the thread still has
|
debug registers. To get at the address and cause of the trap, we
|
||||||
in its debug registers.
|
need to read the state the thread still has in its debug
|
||||||
|
registers.
|
||||||
|
|
||||||
In sum, always get the current debug register values the current
|
In sum, always get the current debug register values the current
|
||||||
thread has, instead of trusting the global mirror. If the thread
|
thread has, instead of trusting the global mirror. If the thread
|
||||||
@ -727,6 +727,9 @@ i386_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return non-zero if the inferior has some watchpoint that triggered.
|
||||||
|
Otherwise return zero. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
i386_stopped_by_watchpoint (struct target_ops *ops)
|
i386_stopped_by_watchpoint (struct target_ops *ops)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user