aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2009-11-22 15:38:59 +0000
committerPedro Alves <palves@redhat.com>2009-11-22 15:38:59 +0000
commit9093389c0fbe371727b8725a3036c113bed015f0 (patch)
treec34658207a27617a1ae8c924803f5e3c8e6b4939 /gdb/breakpoint.c
parent815368956efb53c3abb890e00886a8866dd7adf9 (diff)
downloadgdb-9093389c0fbe371727b8725a3036c113bed015f0.zip
gdb-9093389c0fbe371727b8725a3036c113bed015f0.tar.gz
gdb-9093389c0fbe371727b8725a3036c113bed015f0.tar.bz2
Make hardware watchpoints work for process record.
* breakpoint.c (hardware_watchpoint_inserted_in_range): New. * breakpoint.h (hardware_watchpoint_inserted_in_range): Declare. * record.c (record_beneath_to_stopped_by_watchpoint) (record_beneath_to_stopped_data_address, record_hw_watchpoint): New globals. (record_exec_insn): Check for watchpoint hits. (tmp_to_stopped_by_watchpoint, tmp_to_stopped_data_address): New globals. (record_open): Set tmp_to_stopped_by_watchpoint, tmp_to_stopped_data_address, record_beneath_to_stopped_by_watchpoint and record_beneath_to_stopped_data_address. (record_wait): Report watchpoint hits to the core. Update and extend comments. (record_stopped_by_watchpoint): New. (record_stopped_data_address): New. (init_record_ops): Install them. (init_record_core_ops): Ditto.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index fb6b948..90d9247 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -2380,6 +2380,38 @@ software_breakpoint_inserted_here_p (struct address_space *aspace, CORE_ADDR pc)
return 0;
}
+int
+hardware_watchpoint_inserted_in_range (struct address_space *aspace,
+ CORE_ADDR addr, ULONGEST len)
+{
+ struct breakpoint *bpt;
+
+ ALL_BREAKPOINTS (bpt)
+ {
+ struct bp_location *loc;
+
+ if (bpt->type != bp_hardware_watchpoint
+ && bpt->type != bp_access_watchpoint)
+ continue;
+
+ if (!breakpoint_enabled (bpt))
+ continue;
+
+ for (loc = bpt->loc; loc; loc = loc->next)
+ if (loc->pspace->aspace == aspace && loc->inserted)
+ {
+ CORE_ADDR l, h;
+
+ /* Check for intersection. */
+ l = max (loc->address, addr);
+ h = min (loc->address + loc->length, addr + len);
+ if (l < h)
+ return 1;
+ }
+ }
+ return 0;
+}
+
/* breakpoint_thread_match (PC, PTID) returns true if the breakpoint at
PC is valid for process/thread PTID. */