ChangeLog:

2009-12-03  Paul Pluzhnikov  <ppluzhnikov@google.com>

	PR gdb/11022

	* breakpoint.c (invalidate_bp_value_on_memory_change):
	New function.
	(_initialize_breakpoint): Add it as memory change observer.

testsuite/ChangeLog:

2009-12-03  Paul Pluzhnikov  <ppluzhnikov@google.com>

       PR gdb/11022

       * gdb.base/pr11022.exp: New test.
       * gdb.base/pr11022.c: New test.
This commit is contained in:
Paul Pluzhnikov
2009-12-03 17:47:08 +00:00
parent 67c2a3e8c9
commit 1f3b5d1baf
5 changed files with 135 additions and 0 deletions

View File

@@ -9490,6 +9490,35 @@ show_breakpoint_cmd (char *args, int from_tty)
{
}
/* Invalidate last known value of any hardware watchpoint if
the memory which that value represents has been written to by
GDB itself. */
static void
invalidate_bp_value_on_memory_change (CORE_ADDR addr, int len,
const bfd_byte *data)
{
struct breakpoint *bp;
ALL_BREAKPOINTS (bp)
if (bp->enable_state == bp_enabled
&& bp->type == bp_hardware_watchpoint
&& bp->val_valid && bp->val)
{
struct bp_location *loc;
for (loc = bp->loc; loc != NULL; loc = loc->next)
if (loc->loc_type == bp_loc_hardware_watchpoint
&& loc->address + loc->length > addr
&& addr + len > loc->address)
{
value_free (bp->val);
bp->val = NULL;
bp->val_valid = 0;
}
}
}
/* Use default_breakpoint_'s, or nothing if they aren't valid. */
struct symtabs_and_lines
@@ -10077,6 +10106,7 @@ _initialize_breakpoint (void)
observer_attach_solib_unloaded (disable_breakpoints_in_unloaded_shlib);
observer_attach_inferior_exit (clear_syscall_counts);
observer_attach_memory_changed (invalidate_bp_value_on_memory_change);
breakpoint_chain = 0;
/* Don't bother to call set_breakpoint_count. $bpnum isn't useful