2010-01-11 Thiago Jung Bauermann <bauerman@br.ibm.com>

Convert hardware watchpoints to use breakpoint_ops.

gdb/
	* breakpoint.h (breakpoint_ops) <insert>: Rename to...
	<insert_location>: ... this.  Return int instead of void.
	Accept pointer to struct bp_location instead of pointer to
	struct breakpoint.  Adapt all implementations.
	(breakpoint_ops) <remove>: Rename to...
	<remove_location>: ... this.  Accept pointer to struct bp_location
	instead of pointer to struct breakpoint.  Adapt all implementations.
	* breakpoint.c (insert_catchpoint): Delete function.
	(insert_bp_location): Call the watchpoint or catchpoint's
	breakpoint_ops.insert method.
	(remove_breakpoint_1): Call the watchpoint or catchpoint's
	breakpoint_ops.remove method.
	(insert_watchpoint, remove_watchpoint): New functions.
	(watchpoint_breakpoint_ops): New structure.
	(watch_command_1): Initialize the OPS field.
	* inf-child.c (inf_child_insert_fork_catchpoint)
	(inf_child_remove_fork_catchpoint, inf_child_insert_vfork_catchpoint)
	(inf_child_remove_vfork_catchpoint, inf_child_insert_exec_catchpoint)
	(inf_child_remove_exec_catchpoint, inf_child_set_syscall_catchpoint):
	Delete functions.
	(inf_child_target): Remove initialization of to_insert_fork_catchpoint,
	to_remove_fork_catchpoint, to_insert_vfork_catchpoint,
	to_remove_vfork_catchpoint, to_insert_exec_catchpoint,
	to_remove_exec_catchpoint and to_set_syscall_catchpoint.
	* target.c (update_current_target): Change default implementation of
	to_insert_fork_catchpoint, to_remove_fork_catchpoint,
	to_insert_vfork_catchpoint, to_remove_vfork_catchpoint,
	to_insert_exec_catchpoint, to_remove_exec_catchpoint and
	to_set_syscall_catchpoint to return_one.
	(debug_to_insert_fork_catchpoint, debug_to_insert_vfork_catchpoint)
	(debug_to_insert_exec_catchpoint): Report return value.
	* target.h (to_insert_fork_catchpoint, to_insert_vfork_catchpoint)
	(to_insert_exec_catchpoint): Change declaration to return int instead
	of void.

gdb/testsuite/
	* gdb.base/foll-exec.exp: Adapt to new error string when the catchpoint
	type is not supported.
	* gdb.base/foll-fork.exp: Likewise.
	* gdb.base/foll-vfork.exp: Likewise.
This commit is contained in:
Thiago Jung Bauermann 2011-01-11 19:16:23 +00:00
parent 3143e5a930
commit 77b06cd719
11 changed files with 205 additions and 170 deletions

View file

@ -779,26 +779,26 @@ update_current_target (void)
(void (*) (ptid_t))
target_ignore);
de_fault (to_insert_fork_catchpoint,
(void (*) (int))
tcomplain);
(int (*) (int))
return_one);
de_fault (to_remove_fork_catchpoint,
(int (*) (int))
tcomplain);
return_one);
de_fault (to_insert_vfork_catchpoint,
(void (*) (int))
tcomplain);
(int (*) (int))
return_one);
de_fault (to_remove_vfork_catchpoint,
(int (*) (int))
tcomplain);
return_one);
de_fault (to_insert_exec_catchpoint,
(void (*) (int))
tcomplain);
(int (*) (int))
return_one);
de_fault (to_remove_exec_catchpoint,
(int (*) (int))
tcomplain);
return_one);
de_fault (to_set_syscall_catchpoint,
(int (*) (int, int, int, int, int *))
tcomplain);
return_one);
de_fault (to_has_exited,
(int (*) (int, int, int *))
return_zero);
@ -3661,13 +3661,17 @@ debug_to_post_startup_inferior (ptid_t ptid)
PIDGET (ptid));
}
static void
static int
debug_to_insert_fork_catchpoint (int pid)
{
debug_target.to_insert_fork_catchpoint (pid);
int retval;
fprintf_unfiltered (gdb_stdlog, "target_insert_fork_catchpoint (%d)\n",
pid);
retval = debug_target.to_insert_fork_catchpoint (pid);
fprintf_unfiltered (gdb_stdlog, "target_insert_fork_catchpoint (%d) = %d\n",
pid, retval);
return retval;
}
static int
@ -3683,13 +3687,17 @@ debug_to_remove_fork_catchpoint (int pid)
return retval;
}
static void
static int
debug_to_insert_vfork_catchpoint (int pid)
{
debug_target.to_insert_vfork_catchpoint (pid);
int retval;
fprintf_unfiltered (gdb_stdlog, "target_insert_vfork_catchpoint (%d)\n",
pid);
retval = debug_target.to_insert_vfork_catchpoint (pid);
fprintf_unfiltered (gdb_stdlog, "target_insert_vfork_catchpoint (%d) = %d\n",
pid, retval);
return retval;
}
static int
@ -3705,13 +3713,17 @@ debug_to_remove_vfork_catchpoint (int pid)
return retval;
}
static void
static int
debug_to_insert_exec_catchpoint (int pid)
{
debug_target.to_insert_exec_catchpoint (pid);
int retval;
fprintf_unfiltered (gdb_stdlog, "target_insert_exec_catchpoint (%d)\n",
pid);
retval = debug_target.to_insert_exec_catchpoint (pid);
fprintf_unfiltered (gdb_stdlog, "target_insert_exec_catchpoint (%d) = %d\n",
pid, retval);
return retval;
}
static int