From 9093389c0fbe371727b8725a3036c113bed015f0 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Sun, 22 Nov 2009 15:38:59 +0000 Subject: 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. --- gdb/breakpoint.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'gdb/breakpoint.c') 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. */ -- cgit v1.1