From: Tom Tromey Date: Fri, 20 Dec 2013 17:30:13 +0000 (-0700) Subject: convert to_disconnect X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=86a0854a691a220419785b2008bf2fb0ddd6e46f;p=binutils-gdb.git convert to_disconnect 2014-02-19 Tom Tromey * target-delegates.c: Rebuild. * target.c (target_disconnect): Unconditionally delegate. * target.h (struct target_ops) : Use TARGET_DEFAULT_NORETURN. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index aa699ba9353..18792c6c52c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2014-02-19 Tom Tromey + + * target-delegates.c: Rebuild. + * target.c (target_disconnect): Unconditionally delegate. + * target.h (struct target_ops) : Use + TARGET_DEFAULT_NORETURN. + 2014-02-19 Tom Tromey * record.c (record_stop): Unconditionally delegate. diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index 4b90a2f2bad..1565c78bdc8 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -34,6 +34,19 @@ tdefault_detach (struct target_ops *self, const char *arg1, int arg2) { } +static void +delegate_disconnect (struct target_ops *self, char *arg1, int arg2) +{ + self = self->beneath; + self->to_disconnect (self, arg1, arg2); +} + +static void +tdefault_disconnect (struct target_ops *self, char *arg1, int arg2) +{ + tcomplain (); +} + static void delegate_resume (struct target_ops *self, ptid_t arg1, int arg2, enum gdb_signal arg3) { @@ -1542,6 +1555,8 @@ install_delegators (struct target_ops *ops) ops->to_post_attach = delegate_post_attach; if (ops->to_detach == NULL) ops->to_detach = delegate_detach; + if (ops->to_disconnect == NULL) + ops->to_disconnect = delegate_disconnect; if (ops->to_resume == NULL) ops->to_resume = delegate_resume; if (ops->to_wait == NULL) @@ -1800,6 +1815,7 @@ install_dummy_methods (struct target_ops *ops) ops->to_attach = find_default_attach; ops->to_post_attach = tdefault_post_attach; ops->to_detach = tdefault_detach; + ops->to_disconnect = tdefault_disconnect; ops->to_resume = tdefault_resume; ops->to_wait = tdefault_wait; ops->to_fetch_registers = tdefault_fetch_registers; diff --git a/gdb/target.c b/gdb/target.c index ef7374e1b99..bf93220b446 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -2470,24 +2470,15 @@ target_detach (const char *args, int from_tty) void target_disconnect (char *args, int from_tty) { - struct target_ops *t; - /* If we're in breakpoints-always-inserted mode or if breakpoints are global across processes, we have to remove them before disconnecting. */ remove_breakpoints (); - for (t = current_target.beneath; t != NULL; t = t->beneath) - if (t->to_disconnect != NULL) - { - if (targetdebug) - fprintf_unfiltered (gdb_stdlog, "target_disconnect (%s, %d)\n", - args, from_tty); - t->to_disconnect (t, args, from_tty); - return; - } - - tcomplain (); + if (targetdebug) + fprintf_unfiltered (gdb_stdlog, "target_disconnect (%s, %d)\n", + args, from_tty); + current_target.to_disconnect (¤t_target, args, from_tty); } ptid_t diff --git a/gdb/target.h b/gdb/target.h index 1437cc4c917..1ceb74d099a 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -409,7 +409,8 @@ struct target_ops TARGET_DEFAULT_IGNORE (); void (*to_detach) (struct target_ops *ops, const char *, int) TARGET_DEFAULT_IGNORE (); - void (*to_disconnect) (struct target_ops *, char *, int); + void (*to_disconnect) (struct target_ops *, char *, int) + TARGET_DEFAULT_NORETURN (tcomplain ()); void (*to_resume) (struct target_ops *, ptid_t, int, enum gdb_signal) TARGET_DEFAULT_NORETURN (noprocess ()); ptid_t (*to_wait) (struct target_ops *,