From 6c7e5e5cdc78f2930423b87d76006e067749e6ba Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 18 Dec 2013 14:34:15 -0700 Subject: [PATCH] convert to_masked_watch_num_registers 2014-02-19 Tom Tromey * target-delegates.c: Rebuild. * target.c (target_masked_watch_num_registers): Unconditionally delegate. * target.h (struct target_ops) : Use TARGET_DEFAULT_RETURN. --- gdb/ChangeLog | 8 ++++++++ gdb/target-delegates.c | 16 ++++++++++++++++ gdb/target.c | 9 ++------- gdb/target.h | 3 ++- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 45d853c1e99..4217562329d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2014-02-19 Tom Tromey + + * target-delegates.c: Rebuild. + * target.c (target_masked_watch_num_registers): Unconditionally + delegate. + * target.h (struct target_ops) : + Use TARGET_DEFAULT_RETURN. + 2014-02-19 Tom Tromey * target-delegates.c: Rebuild. diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index 164739ddee6..9d7065caf47 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -281,6 +281,19 @@ tdefault_can_accel_watchpoint_condition (struct target_ops *self, CORE_ADDR arg1 return 0; } +static int +delegate_masked_watch_num_registers (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2) +{ + self = self->beneath; + return self->to_masked_watch_num_registers (self, arg1, arg2); +} + +static int +tdefault_masked_watch_num_registers (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2) +{ + return -1; +} + static void delegate_terminal_init (struct target_ops *self) { @@ -1176,6 +1189,8 @@ install_delegators (struct target_ops *ops) ops->to_region_ok_for_hw_watchpoint = delegate_region_ok_for_hw_watchpoint; if (ops->to_can_accel_watchpoint_condition == NULL) ops->to_can_accel_watchpoint_condition = delegate_can_accel_watchpoint_condition; + if (ops->to_masked_watch_num_registers == NULL) + ops->to_masked_watch_num_registers = delegate_masked_watch_num_registers; if (ops->to_terminal_init == NULL) ops->to_terminal_init = delegate_terminal_init; if (ops->to_terminal_inferior == NULL) @@ -1345,6 +1360,7 @@ install_dummy_methods (struct target_ops *ops) ops->to_watchpoint_addr_within_range = default_watchpoint_addr_within_range; ops->to_region_ok_for_hw_watchpoint = default_region_ok_for_hw_watchpoint; ops->to_can_accel_watchpoint_condition = tdefault_can_accel_watchpoint_condition; + ops->to_masked_watch_num_registers = tdefault_masked_watch_num_registers; ops->to_terminal_init = tdefault_terminal_init; ops->to_terminal_inferior = tdefault_terminal_inferior; ops->to_terminal_ours_for_output = tdefault_terminal_ours_for_output; diff --git a/gdb/target.c b/gdb/target.c index 6f1c1bc7a60..8306906b84b 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -3870,13 +3870,8 @@ target_remove_mask_watchpoint (%s, %s, %d) = %d\n", int target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask) { - struct target_ops *t; - - for (t = current_target.beneath; t != NULL; t = t->beneath) - if (t->to_masked_watch_num_registers != NULL) - return t->to_masked_watch_num_registers (t, addr, mask); - - return -1; + return current_target.to_masked_watch_num_registers (¤t_target, + addr, mask); } /* The documentation for this function is in its prototype declaration diff --git a/gdb/target.h b/gdb/target.h index 4af2148465c..696020cfced 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -503,7 +503,8 @@ struct target_ops struct expression *) TARGET_DEFAULT_RETURN (0); int (*to_masked_watch_num_registers) (struct target_ops *, - CORE_ADDR, CORE_ADDR); + CORE_ADDR, CORE_ADDR) + TARGET_DEFAULT_RETURN (-1); void (*to_terminal_init) (struct target_ops *) TARGET_DEFAULT_IGNORE (); void (*to_terminal_inferior) (struct target_ops *) -- 2.30.2