From ad5989bd21c9941358ea33a79e6fad47a93c2b47 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 18 Dec 2013 14:30:22 -0700 Subject: [PATCH] convert to_fetch_registers 2014-02-19 Tom Tromey * target-delegates.c: Rebuild. * target.c (target_fetch_registers): Unconditionally delegate. * target.h (struct target_ops) : Use TARGET_DEFAULT_NORETURN. --- gdb/ChangeLog | 7 +++++++ gdb/target-delegates.c | 15 +++++++++++++++ gdb/target.c | 15 +++------------ gdb/target.h | 3 ++- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 95d308fdc32..1f352eaf688 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2014-02-19 Tom Tromey + + * target-delegates.c: Rebuild. + * target.c (target_fetch_registers): Unconditionally delegate. + * target.h (struct target_ops) : Use + TARGET_DEFAULT_NORETURN. + 2014-02-19 Tom Tromey * target-delegates.c: Rebuild. diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index 122005883a3..f813e35f329 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -60,6 +60,18 @@ tdefault_wait (struct target_ops *self, ptid_t arg1, struct target_waitstatus *a noprocess (); } +static void +delegate_fetch_registers (struct target_ops *self, struct regcache *arg1, int arg2) +{ + self = self->beneath; + self->to_fetch_registers (self, arg1, arg2); +} + +static void +tdefault_fetch_registers (struct target_ops *self, struct regcache *arg1, int arg2) +{ +} + static void delegate_store_registers (struct target_ops *self, struct regcache *arg1, int arg2) { @@ -1087,6 +1099,8 @@ install_delegators (struct target_ops *ops) ops->to_resume = delegate_resume; if (ops->to_wait == NULL) ops->to_wait = delegate_wait; + if (ops->to_fetch_registers == NULL) + ops->to_fetch_registers = delegate_fetch_registers; if (ops->to_store_registers == NULL) ops->to_store_registers = delegate_store_registers; if (ops->to_prepare_to_store == NULL) @@ -1267,6 +1281,7 @@ install_dummy_methods (struct target_ops *ops) ops->to_detach = tdefault_detach; ops->to_resume = tdefault_resume; ops->to_wait = tdefault_wait; + ops->to_fetch_registers = tdefault_fetch_registers; ops->to_store_registers = tdefault_store_registers; ops->to_prepare_to_store = tdefault_prepare_to_store; ops->to_files_info = tdefault_files_info; diff --git a/gdb/target.c b/gdb/target.c index 0432dfd06d0..f656db37173 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -3758,18 +3758,9 @@ debug_print_register (const char * func, void target_fetch_registers (struct regcache *regcache, int regno) { - struct target_ops *t; - - for (t = current_target.beneath; t != NULL; t = t->beneath) - { - if (t->to_fetch_registers != NULL) - { - t->to_fetch_registers (t, regcache, regno); - if (targetdebug) - debug_print_register ("target_fetch_registers", regcache, regno); - return; - } - } + current_target.to_fetch_registers (¤t_target, regcache, regno); + if (targetdebug) + debug_print_register ("target_fetch_registers", regcache, regno); } void diff --git a/gdb/target.h b/gdb/target.h index 64f6b6e94e9..0aee7a9d51d 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -415,7 +415,8 @@ struct target_ops ptid_t (*to_wait) (struct target_ops *, ptid_t, struct target_waitstatus *, int) TARGET_DEFAULT_NORETURN (noprocess ()); - void (*to_fetch_registers) (struct target_ops *, struct regcache *, int); + void (*to_fetch_registers) (struct target_ops *, struct regcache *, int) + TARGET_DEFAULT_IGNORE (); void (*to_store_registers) (struct target_ops *, struct regcache *, int) TARGET_DEFAULT_NORETURN (noprocess ()); void (*to_prepare_to_store) (struct target_ops *, struct regcache *) -- 2.30.2