aboutsummaryrefslogtreecommitdiff
path: root/gdb/amd64-linux-nat.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2009-11-20 19:57:29 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2009-11-20 19:57:29 +0000
commita79d3c27d1827de4f4b428644ae1447c93a13de5 (patch)
tree36a6ba5b863c026b202ce7eade50781a79e0aba6 /gdb/amd64-linux-nat.c
parentebec9a0f77584145a70e8f5627dd590bae43b580 (diff)
downloadgdb-a79d3c27d1827de4f4b428644ae1447c93a13de5.zip
gdb-a79d3c27d1827de4f4b428644ae1447c93a13de5.tar.gz
gdb-a79d3c27d1827de4f4b428644ae1447c93a13de5.tar.bz2
gdb/
Fix repeated rwatch output. * amd64-linux-nat.c (amd64_linux_dr_set, amd64_linux_dr_set_control) (amd64_linux_dr_set_addr, amd64_linux_dr_reset_addr) (amd64_linux_dr_get_status): New comments. (amd64_linux_dr_unset_status): New function. (_initialize_amd64_linux_nat): Install it. * i386-linux-nat.c (i386_linux_dr_get, i386_linux_dr_set) (i386_linux_dr_set_control, i386_linux_dr_set_addr) (i386_linux_dr_reset_addr, i386_linux_dr_get_status): New comments. (i386_linux_dr_unset_status): New function. (_initialize_i386_linux_nat): Install it. * i386-nat.c (I386_DR_WATCH_MASK): New macro. (I386_DR_WATCH_HIT): Use I386_DR_WATCH_MASK. (i386_insert_aligned_watchpoint): Call i386_dr_low.unset_status. * i386-nat.h (struct i386_dr_low_type): Extend comments for set_control, set_addr, reset_addr and get_status. New unset_status. * breakpoint.c (update_watchpoint): Extend the comment. gdb/testsuite/ * gdb.base/watchpoint-hw-hit-once.exp, gdb.base/watchpoint-hw-hit-once.c: New.
Diffstat (limited to 'gdb/amd64-linux-nat.c')
-rw-r--r--gdb/amd64-linux-nat.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index 7d8461c..9ccd3b2 100644
--- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c
@@ -270,6 +270,8 @@ amd64_linux_dr_get (ptid_t ptid, int regnum)
return value;
}
+/* Set debug register REGNUM to VALUE in only the one LWP of PTID. */
+
static void
amd64_linux_dr_set (ptid_t ptid, int regnum, unsigned long value)
{
@@ -286,6 +288,8 @@ amd64_linux_dr_set (ptid_t ptid, int regnum, unsigned long value)
perror_with_name (_("Couldn't write debug register"));
}
+/* Set DR_CONTROL to ADDR in all LWPs of LWP_LIST. */
+
static void
amd64_linux_dr_set_control (unsigned long control)
{
@@ -297,6 +301,8 @@ amd64_linux_dr_set_control (unsigned long control)
amd64_linux_dr_set (ptid, DR_CONTROL, control);
}
+/* Set address REGNUM (zero based) to ADDR in all LWPs of LWP_LIST. */
+
static void
amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr)
{
@@ -310,18 +316,41 @@ amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr)
amd64_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr);
}
+/* Set address REGNUM (zero based) to zero in all LWPs of LWP_LIST. */
+
static void
amd64_linux_dr_reset_addr (int regnum)
{
amd64_linux_dr_set_addr (regnum, 0);
}
+/* Get DR_STATUS from only the one LWP of INFERIOR_PTID. */
+
static unsigned long
amd64_linux_dr_get_status (void)
{
return amd64_linux_dr_get (inferior_ptid, DR_STATUS);
}
+/* Unset MASK bits in DR_STATUS in all LWPs of LWP_LIST. */
+
+static void
+amd64_linux_dr_unset_status (unsigned long mask)
+{
+ struct lwp_info *lp;
+ ptid_t ptid;
+
+ ALL_LWPS (lp, ptid)
+ {
+ unsigned long value;
+
+ value = amd64_linux_dr_get (ptid, DR_STATUS);
+ value &= ~mask;
+ amd64_linux_dr_set (ptid, DR_STATUS, value);
+ }
+}
+
+
static void
amd64_linux_new_thread (ptid_t ptid)
{
@@ -672,6 +701,7 @@ _initialize_amd64_linux_nat (void)
i386_dr_low.set_addr = amd64_linux_dr_set_addr;
i386_dr_low.reset_addr = amd64_linux_dr_reset_addr;
i386_dr_low.get_status = amd64_linux_dr_get_status;
+ i386_dr_low.unset_status = amd64_linux_dr_unset_status;
i386_set_debug_register_length (8);
/* Override the GNU/Linux inferior startup hook. */