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

@ -1,3 +1,41 @@
2010-01-11 Thiago Jung Bauermann <bauerman@br.ibm.com>
Convert hardware watchpoints to use breakpoint_ops.
* 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.
2011-01-11 Michael Snyder <msnyder@vmware.com> 2011-01-11 Michael Snyder <msnyder@vmware.com>
* arm-tdep.c: Internationalization. * arm-tdep.c: Internationalization.

View File

@ -1228,18 +1228,6 @@ breakpoint_restore_shadows (gdb_byte *buf, ULONGEST memaddr, LONGEST len)
} }
/* A wrapper function for inserting catchpoints. */
static void
insert_catchpoint (struct ui_out *uo, void *args)
{
struct breakpoint *b = (struct breakpoint *) args;
gdb_assert (b->type == bp_catchpoint);
gdb_assert (b->ops != NULL && b->ops->insert != NULL);
b->ops->insert (b);
}
/* Return true if BPT is of any hardware watchpoint kind. */ /* Return true if BPT is of any hardware watchpoint kind. */
static int static int
@ -1790,10 +1778,10 @@ insert_bp_location (struct bp_location *bl,
watchpoints. It's not clear that it's necessary... */ watchpoints. It's not clear that it's necessary... */
&& bl->owner->disposition != disp_del_at_next_stop) && bl->owner->disposition != disp_del_at_next_stop)
{ {
val = target_insert_watchpoint (bl->address, gdb_assert (bl->owner->ops != NULL
bl->length, && bl->owner->ops->insert_location != NULL);
bl->watchpoint_type,
bl->owner->cond_exp); val = bl->owner->ops->insert_location (bl);
/* If trying to set a read-watchpoint, and it turns out it's not /* If trying to set a read-watchpoint, and it turns out it's not
supported, try emulating one with an access watchpoint. */ supported, try emulating one with an access watchpoint. */
@ -1819,12 +1807,12 @@ insert_bp_location (struct bp_location *bl,
if (val == 1) if (val == 1)
{ {
val = target_insert_watchpoint (bl->address, bl->watchpoint_type = hw_access;
bl->length, val = bl->owner->ops->insert_location (bl);
hw_access,
bl->owner->cond_exp); if (val)
if (val == 0) /* Back to the original value. */
bl->watchpoint_type = hw_access; bl->watchpoint_type = hw_read;
} }
} }
@ -1833,14 +1821,23 @@ insert_bp_location (struct bp_location *bl,
else if (bl->owner->type == bp_catchpoint) else if (bl->owner->type == bp_catchpoint)
{ {
struct gdb_exception e = catch_exception (uiout, insert_catchpoint, gdb_assert (bl->owner->ops != NULL
bl->owner, RETURN_MASK_ERROR); && bl->owner->ops->insert_location != NULL);
exception_fprintf (gdb_stderr, e, "warning: inserting catchpoint %d: ",
bl->owner->number); val = bl->owner->ops->insert_location (bl);
if (e.reason < 0) if (val)
bl->owner->enable_state = bp_disabled; {
else bl->owner->enable_state = bp_disabled;
bl->inserted = 1;
if (val == 1)
warning (_("\
Error inserting catchpoint %d: Your system does not support this type\n\
of catchpoint."), bl->owner->number);
else
warning (_("Error inserting catchpoint %d."), bl->owner->number);
}
bl->inserted = (val == 0);
/* We've already printed an error message if there was a problem /* We've already printed an error message if there was a problem
inserting this catchpoint, and we've disabled the catchpoint, inserting this catchpoint, and we've disabled the catchpoint,
@ -2537,10 +2534,11 @@ remove_breakpoint_1 (struct bp_location *bl, insertion_state_t is)
} }
else if (bl->loc_type == bp_loc_hardware_watchpoint) else if (bl->loc_type == bp_loc_hardware_watchpoint)
{ {
gdb_assert (bl->owner->ops != NULL
&& bl->owner->ops->remove_location != NULL);
bl->inserted = (is == mark_inserted); bl->inserted = (is == mark_inserted);
val = target_remove_watchpoint (bl->address, bl->length, bl->owner->ops->remove_location (bl);
bl->watchpoint_type,
bl->owner->cond_exp);
/* Failure to remove any of the hardware watchpoints comes here. */ /* Failure to remove any of the hardware watchpoints comes here. */
if ((is == mark_uninserted) && (bl->inserted)) if ((is == mark_uninserted) && (bl->inserted))
@ -2551,11 +2549,13 @@ remove_breakpoint_1 (struct bp_location *bl, insertion_state_t is)
&& breakpoint_enabled (bl->owner) && breakpoint_enabled (bl->owner)
&& !bl->duplicate) && !bl->duplicate)
{ {
gdb_assert (bl->owner->ops != NULL && bl->owner->ops->remove != NULL); gdb_assert (bl->owner->ops != NULL
&& bl->owner->ops->remove_location != NULL);
val = bl->owner->ops->remove (bl->owner); val = bl->owner->ops->remove_location (bl);
if (val) if (val)
return val; return val;
bl->inserted = (is == mark_inserted); bl->inserted = (is == mark_inserted);
} }
@ -5997,17 +5997,17 @@ disable_breakpoints_in_unloaded_shlib (struct so_list *solib)
/* Implement the "insert" breakpoint_ops method for fork /* Implement the "insert" breakpoint_ops method for fork
catchpoints. */ catchpoints. */
static void static int
insert_catch_fork (struct breakpoint *b) insert_catch_fork (struct bp_location *bl)
{ {
target_insert_fork_catchpoint (PIDGET (inferior_ptid)); return target_insert_fork_catchpoint (PIDGET (inferior_ptid));
} }
/* Implement the "remove" breakpoint_ops method for fork /* Implement the "remove" breakpoint_ops method for fork
catchpoints. */ catchpoints. */
static int static int
remove_catch_fork (struct breakpoint *b) remove_catch_fork (struct bp_location *bl)
{ {
return target_remove_fork_catchpoint (PIDGET (inferior_ptid)); return target_remove_fork_catchpoint (PIDGET (inferior_ptid));
} }
@ -6093,17 +6093,17 @@ static struct breakpoint_ops catch_fork_breakpoint_ops =
/* Implement the "insert" breakpoint_ops method for vfork /* Implement the "insert" breakpoint_ops method for vfork
catchpoints. */ catchpoints. */
static void static int
insert_catch_vfork (struct breakpoint *b) insert_catch_vfork (struct bp_location *bl)
{ {
target_insert_vfork_catchpoint (PIDGET (inferior_ptid)); return target_insert_vfork_catchpoint (PIDGET (inferior_ptid));
} }
/* Implement the "remove" breakpoint_ops method for vfork /* Implement the "remove" breakpoint_ops method for vfork
catchpoints. */ catchpoints. */
static int static int
remove_catch_vfork (struct breakpoint *b) remove_catch_vfork (struct bp_location *bl)
{ {
return target_remove_vfork_catchpoint (PIDGET (inferior_ptid)); return target_remove_vfork_catchpoint (PIDGET (inferior_ptid));
} }
@ -6188,20 +6188,20 @@ static struct breakpoint_ops catch_vfork_breakpoint_ops =
/* Implement the "insert" breakpoint_ops method for syscall /* Implement the "insert" breakpoint_ops method for syscall
catchpoints. */ catchpoints. */
static void static int
insert_catch_syscall (struct breakpoint *b) insert_catch_syscall (struct bp_location *bl)
{ {
struct inferior *inf = current_inferior (); struct inferior *inf = current_inferior ();
++inf->total_syscalls_count; ++inf->total_syscalls_count;
if (!b->syscalls_to_be_caught) if (!bl->owner->syscalls_to_be_caught)
++inf->any_syscall_count; ++inf->any_syscall_count;
else else
{ {
int i, iter; int i, iter;
for (i = 0; for (i = 0;
VEC_iterate (int, b->syscalls_to_be_caught, i, iter); VEC_iterate (int, bl->owner->syscalls_to_be_caught, i, iter);
i++) i++)
{ {
int elem; int elem;
@ -6223,30 +6223,30 @@ insert_catch_syscall (struct breakpoint *b)
} }
} }
target_set_syscall_catchpoint (PIDGET (inferior_ptid), return target_set_syscall_catchpoint (PIDGET (inferior_ptid),
inf->total_syscalls_count != 0, inf->total_syscalls_count != 0,
inf->any_syscall_count, inf->any_syscall_count,
VEC_length (int, inf->syscalls_counts), VEC_length (int, inf->syscalls_counts),
VEC_address (int, inf->syscalls_counts)); VEC_address (int, inf->syscalls_counts));
} }
/* Implement the "remove" breakpoint_ops method for syscall /* Implement the "remove" breakpoint_ops method for syscall
catchpoints. */ catchpoints. */
static int static int
remove_catch_syscall (struct breakpoint *b) remove_catch_syscall (struct bp_location *bl)
{ {
struct inferior *inf = current_inferior (); struct inferior *inf = current_inferior ();
--inf->total_syscalls_count; --inf->total_syscalls_count;
if (!b->syscalls_to_be_caught) if (!bl->owner->syscalls_to_be_caught)
--inf->any_syscall_count; --inf->any_syscall_count;
else else
{ {
int i, iter; int i, iter;
for (i = 0; for (i = 0;
VEC_iterate (int, b->syscalls_to_be_caught, i, iter); VEC_iterate (int, bl->owner->syscalls_to_be_caught, i, iter);
i++) i++)
{ {
int elem; int elem;
@ -6546,14 +6546,14 @@ create_fork_vfork_event_catchpoint (struct gdbarch *gdbarch,
/* Exec catchpoints. */ /* Exec catchpoints. */
static void static int
insert_catch_exec (struct breakpoint *b) insert_catch_exec (struct bp_location *bl)
{ {
target_insert_exec_catchpoint (PIDGET (inferior_ptid)); return target_insert_exec_catchpoint (PIDGET (inferior_ptid));
} }
static int static int
remove_catch_exec (struct breakpoint *b) remove_catch_exec (struct bp_location *bl)
{ {
return target_remove_exec_catchpoint (PIDGET (inferior_ptid)); return target_remove_exec_catchpoint (PIDGET (inferior_ptid));
} }
@ -8211,6 +8211,37 @@ watchpoint_exp_is_const (const struct expression *exp)
return 1; return 1;
} }
/* Implement the "insert" breakpoint_ops method for hardware watchpoints. */
static int
insert_watchpoint (struct bp_location *bl)
{
return target_insert_watchpoint (bl->address, bl->length,
bl->watchpoint_type, bl->owner->cond_exp);
}
/* Implement the "remove" breakpoint_ops method for hardware watchpoints. */
static int
remove_watchpoint (struct bp_location *bl)
{
return target_remove_watchpoint (bl->address, bl->length,
bl->watchpoint_type, bl->owner->cond_exp);
}
/* The breakpoint_ops structure to be used in hardware watchpoints. */
static struct breakpoint_ops watchpoint_breakpoint_ops =
{
insert_watchpoint,
remove_watchpoint,
NULL, /* breakpoint_hit */
NULL, /* print_it */
NULL, /* print_one */
NULL, /* print_mention */
NULL /* print_recreate */
};
/* accessflag: hw_write: watch write, /* accessflag: hw_write: watch write,
hw_read: watch read, hw_read: watch read,
hw_access: watch access (read or write) */ hw_access: watch access (read or write) */
@ -8454,6 +8485,8 @@ watch_command_1 (char *arg, int accessflag, int from_tty,
b->exp_string = savestring (exp_start, exp_end - exp_start); b->exp_string = savestring (exp_start, exp_end - exp_start);
b->val = val; b->val = val;
b->val_valid = 1; b->val_valid = 1;
b->ops = &watchpoint_breakpoint_ops;
if (cond_start) if (cond_start)
b->cond_string = savestring (cond_start, cond_end - cond_start); b->cond_string = savestring (cond_start, cond_end - cond_start);
else else

View File

@ -368,16 +368,18 @@ struct bp_location
will be called instead of the performing the default action for this will be called instead of the performing the default action for this
bptype. */ bptype. */
struct breakpoint_ops struct breakpoint_ops
{ {
/* Insert the breakpoint or activate the catchpoint. Should raise /* Insert the breakpoint or watchpoint or activate the catchpoint.
an exception if the operation failed. */ Return 0 for success, 1 if the breakpoint, watchpoint or catchpoint
void (*insert) (struct breakpoint *); type is not supported, -1 for failure. */
int (*insert_location) (struct bp_location *);
/* Remove the breakpoint/catchpoint that was previously inserted /* Remove the breakpoint/catchpoint that was previously inserted
with the "insert" method above. Return non-zero if the operation with the "insert" method above. Return 0 for success, 1 if the
succeeded. */ breakpoint, watchpoint or catchpoint type is not supported,
int (*remove) (struct breakpoint *); -1 for failure. */
int (*remove_location) (struct bp_location *);
/* Return non-zero if the debugger should tell the user that this /* Return non-zero if the debugger should tell the user that this
breakpoint was hit. */ breakpoint was hit. */

View File

@ -87,36 +87,6 @@ inf_child_post_startup_inferior (ptid_t ptid)
inferior" operation by a debugger. */ inferior" operation by a debugger. */
} }
static void
inf_child_insert_fork_catchpoint (int pid)
{
/* This version of Unix doesn't support notification of fork
events. */
}
static int
inf_child_remove_fork_catchpoint (int pid)
{
/* This version of Unix doesn't support notification of fork
events. */
return 0;
}
static void
inf_child_insert_vfork_catchpoint (int pid)
{
/* This version of Unix doesn't support notification of vfork
events. */
}
static int
inf_child_remove_vfork_catchpoint (int pid)
{
/* This version of Unix doesn't support notification of vfork
events. */
return 0;
}
static int static int
inf_child_follow_fork (struct target_ops *ops, int follow_child) inf_child_follow_fork (struct target_ops *ops, int follow_child)
{ {
@ -125,30 +95,6 @@ inf_child_follow_fork (struct target_ops *ops, int follow_child)
return 0; return 0;
} }
static void
inf_child_insert_exec_catchpoint (int pid)
{
/* This version of Unix doesn't support notification of exec
events. */
}
static int
inf_child_remove_exec_catchpoint (int pid)
{
/* This version of Unix doesn't support notification of exec
events. */
return 0;
}
static int
inf_child_set_syscall_catchpoint (int pid, int needed, int any_count,
int table_size, int *table)
{
/* This version of Unix doesn't support notification of syscall
events. */
return 0;
}
static int static int
inf_child_can_run (void) inf_child_can_run (void)
{ {
@ -185,14 +131,7 @@ inf_child_target (void)
t->to_terminal_ours = terminal_ours; t->to_terminal_ours = terminal_ours;
t->to_terminal_info = child_terminal_info; t->to_terminal_info = child_terminal_info;
t->to_post_startup_inferior = inf_child_post_startup_inferior; t->to_post_startup_inferior = inf_child_post_startup_inferior;
t->to_insert_fork_catchpoint = inf_child_insert_fork_catchpoint;
t->to_remove_fork_catchpoint = inf_child_remove_fork_catchpoint;
t->to_insert_vfork_catchpoint = inf_child_insert_vfork_catchpoint;
t->to_remove_vfork_catchpoint = inf_child_remove_vfork_catchpoint;
t->to_follow_fork = inf_child_follow_fork; t->to_follow_fork = inf_child_follow_fork;
t->to_insert_exec_catchpoint = inf_child_insert_exec_catchpoint;
t->to_remove_exec_catchpoint = inf_child_remove_exec_catchpoint;
t->to_set_syscall_catchpoint = inf_child_set_syscall_catchpoint;
t->to_can_run = inf_child_can_run; t->to_can_run = inf_child_can_run;
t->to_pid_to_exec_file = inf_child_pid_to_exec_file; t->to_pid_to_exec_file = inf_child_pid_to_exec_file;
t->to_stratum = process_stratum; t->to_stratum = process_stratum;

View File

@ -974,36 +974,34 @@ holding the child stopped. Try \"set detach-on-fork\" or \
} }
static void static int
linux_child_insert_fork_catchpoint (int pid) linux_child_insert_fork_catchpoint (int pid)
{ {
if (! linux_supports_tracefork (pid)) return !linux_supports_tracefork (pid);
error (_("Your system does not support fork catchpoints."));
} }
static void static int
linux_child_insert_vfork_catchpoint (int pid) linux_child_insert_vfork_catchpoint (int pid)
{ {
if (!linux_supports_tracefork (pid)) return !linux_supports_tracefork (pid);
error (_("Your system does not support vfork catchpoints."));
} }
static void static int
linux_child_insert_exec_catchpoint (int pid) linux_child_insert_exec_catchpoint (int pid)
{ {
if (!linux_supports_tracefork (pid)) return !linux_supports_tracefork (pid);
error (_("Your system does not support exec catchpoints."));
} }
static int static int
linux_child_set_syscall_catchpoint (int pid, int needed, int any_count, linux_child_set_syscall_catchpoint (int pid, int needed, int any_count,
int table_size, int *table) int table_size, int *table)
{ {
if (! linux_supports_tracesysgood (pid)) if (!linux_supports_tracesysgood (pid))
error (_("Your system does not support syscall catchpoints.")); return 1;
/* On GNU/Linux, we ignore the arguments. It means that we only /* On GNU/Linux, we ignore the arguments. It means that we only
enable the syscall catchpoints, but do not disable them. enable the syscall catchpoints, but do not disable them.
Also, we do not use the `table' information because we do not Also, we do not use the `table' information because we do not
filter system calls here. We let GDB do the logic for us. */ filter system calls here. We let GDB do the logic for us. */
return 0; return 0;

View File

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

View File

@ -468,12 +468,12 @@ struct target_ops
void (*to_create_inferior) (struct target_ops *, void (*to_create_inferior) (struct target_ops *,
char *, char *, char **, int); char *, char *, char **, int);
void (*to_post_startup_inferior) (ptid_t); 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); 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_remove_vfork_catchpoint) (int);
int (*to_follow_fork) (struct target_ops *, 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_remove_exec_catchpoint) (int);
int (*to_set_syscall_catchpoint) (int, int, int, int, int *); int (*to_set_syscall_catchpoint) (int, int, int, int, int *);
int (*to_has_exited) (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 /* On some targets, we can catch an inferior fork or vfork event when
it occurs. These functions insert/remove an already-created 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) \ #define target_insert_fork_catchpoint(pid) \
(*current_target.to_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 /* On some targets, we can catch an inferior exec event when it
occurs. These functions insert/remove an already-created 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) \ #define target_insert_exec_catchpoint(pid) \
(*current_target.to_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 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 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) \ #define target_set_syscall_catchpoint(pid, needed, any_count, table_size, table) \
(*current_target.to_set_syscall_catchpoint) (pid, needed, any_count, \ (*current_target.to_set_syscall_catchpoint) (pid, needed, any_count, \

View File

@ -1,3 +1,11 @@
2010-01-11 Thiago Jung Bauermann <bauerman@br.ibm.com>
Convert hardware watchpoints to use breakpoint_ops.
* 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.
2011-01-10 Phil Muldoon <pmuldoon@redhat.com> 2011-01-10 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-cmd.exp: Remove gdb_py_test_multiple function. * gdb.python/py-cmd.exp: Remove gdb_py_test_multiple function.

View File

@ -89,7 +89,7 @@ proc do_exec_tests {} {
gdb_test "catch exec" "Catchpoint \[0-9\]* \\(exec\\)" "insert first exec catchpoint" gdb_test "catch exec" "Catchpoint \[0-9\]* \\(exec\\)" "insert first exec catchpoint"
set has_exec_catchpoints 0 set has_exec_catchpoints 0
gdb_test_multiple "continue" "continue to first exec catchpoint" { gdb_test_multiple "continue" "continue to first exec catchpoint" {
-re ".*Your system does not support exec catchpoints.*$gdb_prompt $" { -re ".*Your system does not support this type\r\nof catchpoint.*$gdb_prompt $" {
unsupported "continue to first exec catchpoint" unsupported "continue to first exec catchpoint"
} }
-re ".*Catchpoint.*$gdb_prompt $" { -re ".*Catchpoint.*$gdb_prompt $" {

View File

@ -45,7 +45,7 @@ proc check_fork_catchpoints {} {
gdb_test "catch fork" "Catchpoint \[0-9\]* \\(fork\\)" "insert first fork catchpoint" gdb_test "catch fork" "Catchpoint \[0-9\]* \\(fork\\)" "insert first fork catchpoint"
set has_fork_catchpoints 0 set has_fork_catchpoints 0
gdb_test_multiple "continue" "continue to first fork catchpoint" { gdb_test_multiple "continue" "continue to first fork catchpoint" {
-re ".*Your system does not support fork catchpoints.*$gdb_prompt $" { -re ".*Your system does not support this type\r\nof catchpoint.*$gdb_prompt $" {
unsupported "continue to first fork catchpoint" unsupported "continue to first fork catchpoint"
} }
-re ".*Catchpoint.*$gdb_prompt $" { -re ".*Catchpoint.*$gdb_prompt $" {

View File

@ -74,7 +74,7 @@ proc check_vfork_catchpoints {} {
gdb_test "catch vfork" "Catchpoint \[0-9\]* \\(vfork\\)" "insert first vfork catchpoint" gdb_test "catch vfork" "Catchpoint \[0-9\]* \\(vfork\\)" "insert first vfork catchpoint"
set has_vfork_catchpoints 0 set has_vfork_catchpoints 0
gdb_test_multiple "continue" "continue to first vfork catchpoint" { gdb_test_multiple "continue" "continue to first vfork catchpoint" {
-re ".*Your system does not support vfork catchpoints.*$gdb_prompt $" { -re ".*Your system does not support this type\r\nof catchpoint.*$gdb_prompt $" {
unsupported "continue to first vfork catchpoint" unsupported "continue to first vfork catchpoint"
} }
-re ".*Catchpoint.*$gdb_prompt $" { -re ".*Catchpoint.*$gdb_prompt $" {