From 77b06cd7198f20bb48b3a148ca8b9efbaa06aa19 Mon Sep 17 00:00:00 2001 From: Thiago Jung Bauermann Date: Tue, 11 Jan 2011 19:16:23 +0000 Subject: 2010-01-11 Thiago Jung Bauermann Convert hardware watchpoints to use breakpoint_ops. gdb/ * breakpoint.h (breakpoint_ops) : Rename to... : ... this. Return int instead of void. Accept pointer to struct bp_location instead of pointer to struct breakpoint. Adapt all implementations. (breakpoint_ops) : Rename to... : ... 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. --- gdb/target.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'gdb/target.h') diff --git a/gdb/target.h b/gdb/target.h index c34625c..72fd211 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -468,12 +468,12 @@ struct target_ops void (*to_create_inferior) (struct target_ops *, char *, char *, char **, int); void (*to_post_startup_inferior) (ptid_t); - void (*to_insert_fork_catchpoint) (int); + int (*to_insert_fork_catchpoint) (int); int (*to_remove_fork_catchpoint) (int); - void (*to_insert_vfork_catchpoint) (int); + int (*to_insert_vfork_catchpoint) (int); int (*to_remove_vfork_catchpoint) (int); int (*to_follow_fork) (struct target_ops *, int); - void (*to_insert_exec_catchpoint) (int); + int (*to_insert_exec_catchpoint) (int); int (*to_remove_exec_catchpoint) (int); int (*to_set_syscall_catchpoint) (int, int, int, int, int *); int (*to_has_exited) (int, int, int *); @@ -1029,7 +1029,8 @@ void target_create_inferior (char *exec_file, char *args, /* On some targets, we can catch an inferior fork or vfork event when it occurs. These functions insert/remove an already-created - catchpoint for such events. */ + catchpoint for such events. They return 0 for success, 1 if the + catchpoint type is not supported and -1 for failure. */ #define target_insert_fork_catchpoint(pid) \ (*current_target.to_insert_fork_catchpoint) (pid) @@ -1055,7 +1056,8 @@ int target_follow_fork (int follow_child); /* On some targets, we can catch an inferior exec event when it occurs. These functions insert/remove an already-created - catchpoint for such events. */ + catchpoint for such events. They return 0 for success, 1 if the + catchpoint type is not supported and -1 for failure. */ #define target_insert_exec_catchpoint(pid) \ (*current_target.to_insert_exec_catchpoint) (pid) @@ -1078,7 +1080,10 @@ int target_follow_fork (int follow_child); TABLE is an array of ints, indexed by syscall number. An element in this array is nonzero if that syscall should be caught. This argument - only matters if ANY_COUNT is zero. */ + only matters if ANY_COUNT is zero. + + Return 0 for success, 1 if syscall catchpoints are not supported or -1 + for failure. */ #define target_set_syscall_catchpoint(pid, needed, any_count, table_size, table) \ (*current_target.to_set_syscall_catchpoint) (pid, needed, any_count, \ -- cgit v1.1