From 6dc7fcf4c1e9cbea86ebd067ce226ffdffa16c08 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 19 Dec 2013 08:19:41 -0700 Subject: [PATCH] convert to_enable_btrace 2014-02-19 Tom Tromey * target-delegates.c: Rebuild. * target.c (target_enable_btrace): Unconditionally delegate. * target.h (struct target_ops) : Use TARGET_DEFAULT_NORETURN. --- gdb/ChangeLog | 7 +++++++ gdb/target-delegates.c | 16 ++++++++++++++++ gdb/target.c | 9 +-------- gdb/target.h | 3 ++- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3cdb9fe46bc..644ebfd7ebb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2014-02-19 Tom Tromey + + * target-delegates.c: Rebuild. + * target.c (target_enable_btrace): 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 1b956d23599..df17c7b62b2 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -1300,6 +1300,19 @@ tdefault_supports_btrace (struct target_ops *self) return 0; } +static struct btrace_target_info * +delegate_enable_btrace (struct target_ops *self, ptid_t arg1) +{ + self = self->beneath; + return self->to_enable_btrace (self, arg1); +} + +static struct btrace_target_info * +tdefault_enable_btrace (struct target_ops *self, ptid_t arg1) +{ + tcomplain (); +} + static void delegate_disable_btrace (struct target_ops *self, struct btrace_target_info *arg1) { @@ -1731,6 +1744,8 @@ install_delegators (struct target_ops *ops) ops->to_can_use_agent = delegate_can_use_agent; if (ops->to_supports_btrace == NULL) ops->to_supports_btrace = delegate_supports_btrace; + if (ops->to_enable_btrace == NULL) + ops->to_enable_btrace = delegate_enable_btrace; if (ops->to_disable_btrace == NULL) ops->to_disable_btrace = delegate_disable_btrace; if (ops->to_teardown_btrace == NULL) @@ -1878,6 +1893,7 @@ install_dummy_methods (struct target_ops *ops) ops->to_use_agent = tdefault_use_agent; ops->to_can_use_agent = tdefault_can_use_agent; ops->to_supports_btrace = tdefault_supports_btrace; + ops->to_enable_btrace = tdefault_enable_btrace; ops->to_disable_btrace = tdefault_disable_btrace; ops->to_teardown_btrace = tdefault_teardown_btrace; ops->to_read_btrace = tdefault_read_btrace; diff --git a/gdb/target.c b/gdb/target.c index 75d961b870f..547afcc8e27 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -3784,14 +3784,7 @@ target_ranged_break_num_registers (void) struct btrace_target_info * target_enable_btrace (ptid_t ptid) { - struct target_ops *t; - - for (t = current_target.beneath; t != NULL; t = t->beneath) - if (t->to_enable_btrace != NULL) - return t->to_enable_btrace (t, ptid); - - tcomplain (); - return NULL; + return current_target.to_enable_btrace (¤t_target, ptid); } /* See target.h. */ diff --git a/gdb/target.h b/gdb/target.h index 13090e193a0..bbc0ecd5286 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1001,7 +1001,8 @@ struct target_ops /* Enable branch tracing for PTID and allocate a branch trace target information struct for reading and for disabling branch trace. */ struct btrace_target_info *(*to_enable_btrace) (struct target_ops *, - ptid_t ptid); + ptid_t ptid) + TARGET_DEFAULT_NORETURN (tcomplain ()); /* Disable branch tracing and deallocate TINFO. */ void (*to_disable_btrace) (struct target_ops *, -- 2.30.2