From 53e1cfc77f60479a222bf52261b6a1f77bc3a445 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 18 Dec 2013 11:12:28 -0700 Subject: [PATCH] convert to_can_execute_reverse 2014-02-19 Tom Tromey * target-delegates.c: Rebuild. * target.c (update_current_target): Don't inherit or default to_can_execute_reverse. * target.h (struct target_ops) : Use TARGET_DEFAULT_RETURN. (target_can_execute_reverse): Unconditionally delegate. --- gdb/ChangeLog | 9 +++++++++ gdb/target-delegates.c | 16 ++++++++++++++++ gdb/target.c | 2 +- gdb/target.h | 6 +++--- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d68cd3fba0b..48940193a8a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2014-02-19 Tom Tromey + + * target-delegates.c: Rebuild. + * target.c (update_current_target): Don't inherit or default + to_can_execute_reverse. + * target.h (struct target_ops) : Use + TARGET_DEFAULT_RETURN. + (target_can_execute_reverse): Unconditionally delegate. + 2014-02-19 Tom Tromey * target-delegates.c: Rebuild. diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index cb03f54c7b2..573f9b5f92c 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -564,6 +564,19 @@ tdefault_xfer_partial (struct target_ops *self, enum target_object arg1, const return TARGET_XFER_E_IO; } +static int +delegate_can_execute_reverse (struct target_ops *self) +{ + self = self->beneath; + return self->to_can_execute_reverse (self); +} + +static int +tdefault_can_execute_reverse (struct target_ops *self) +{ + return 0; +} + static int delegate_supports_btrace (struct target_ops *self) { @@ -678,6 +691,8 @@ install_delegators (struct target_ops *ops) ops->to_goto_bookmark = delegate_goto_bookmark; if (ops->to_xfer_partial == NULL) ops->to_xfer_partial = delegate_xfer_partial; + if (ops->to_can_execute_reverse == NULL) + ops->to_can_execute_reverse = delegate_can_execute_reverse; if (ops->to_supports_btrace == NULL) ops->to_supports_btrace = delegate_supports_btrace; } @@ -734,5 +749,6 @@ install_dummy_methods (struct target_ops *ops) ops->to_get_bookmark = tdefault_get_bookmark; ops->to_goto_bookmark = tdefault_goto_bookmark; ops->to_xfer_partial = tdefault_xfer_partial; + ops->to_can_execute_reverse = tdefault_can_execute_reverse; ops->to_supports_btrace = tdefault_supports_btrace; } diff --git a/gdb/target.c b/gdb/target.c index 5aefda9b3b0..1f60aa0f4d2 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -673,7 +673,7 @@ update_current_target (void) /* Do not inherit to_get_bookmark. */ /* Do not inherit to_goto_bookmark. */ /* Do not inherit to_get_thread_local_address. */ - INHERIT (to_can_execute_reverse, t); + /* Do not inherit to_can_execute_reverse. */ INHERIT (to_execution_direction, t); INHERIT (to_thread_architecture, t); /* Do not inherit to_read_description. */ diff --git a/gdb/target.h b/gdb/target.h index 05a6b1a69f3..9b0ad98f211 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -701,7 +701,8 @@ struct target_ops CORE_ADDR *found_addrp); /* Can target execute in reverse? */ - int (*to_can_execute_reverse) (struct target_ops *); + int (*to_can_execute_reverse) (struct target_ops *) + TARGET_DEFAULT_RETURN (0); /* The direction the target is currently executing. Must be implemented on targets that support reverse execution and async @@ -1759,8 +1760,7 @@ extern int target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask); /* Target can execute in reverse? */ #define target_can_execute_reverse \ - (current_target.to_can_execute_reverse ? \ - current_target.to_can_execute_reverse (¤t_target) : 0) + current_target.to_can_execute_reverse (¤t_target) extern const struct target_desc *target_read_description (struct target_ops *); -- 2.30.2