From: Tom Tromey Date: Wed, 18 Dec 2013 16:35:21 +0000 (-0700) Subject: convert to_rcmd X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a53f36250ea71db7b4968020e2284dc0488a4ce8;p=binutils-gdb.git convert to_rcmd 2014-02-19 Tom Tromey * target-delegates.c: Rebuild. * target.c (update_current_target): Don't inherit or default to_rcmd. (default_rcmd): New function. (do_monitor_command): Unconditionally delegate. * target.h (struct target_ops) : Use TARGET_DEFAULT_FUNC. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 06e26353cae..0ccd337ba92 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2014-02-19 Tom Tromey + + * target-delegates.c: Rebuild. + * target.c (update_current_target): Don't inherit or default + to_rcmd. + (default_rcmd): New function. + (do_monitor_command): Unconditionally delegate. + * target.h (struct target_ops) : Use + TARGET_DEFAULT_FUNC. + 2014-02-19 Tom Tromey * target-delegates.c: Rebuild. diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index 119d3ec8f5e..b2547c0af6b 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -101,6 +101,13 @@ tdefault_stopped_data_address (struct target_ops *self, CORE_ADDR *arg1) return 0; } +static void +delegate_rcmd (struct target_ops *self, char *arg1, struct ui_file *arg2) +{ + self = self->beneath; + self->to_rcmd (self, arg1, arg2); +} + static int delegate_can_async_p (struct target_ops *self) { @@ -175,6 +182,8 @@ install_delegators (struct target_ops *ops) ops->to_stopped_by_watchpoint = delegate_stopped_by_watchpoint; if (ops->to_stopped_data_address == NULL) ops->to_stopped_data_address = delegate_stopped_data_address; + if (ops->to_rcmd == NULL) + ops->to_rcmd = delegate_rcmd; if (ops->to_can_async_p == NULL) ops->to_can_async_p = delegate_can_async_p; if (ops->to_is_async_p == NULL) @@ -199,6 +208,7 @@ install_dummy_methods (struct target_ops *ops) ops->to_remove_breakpoint = memory_remove_breakpoint; ops->to_stopped_by_watchpoint = tdefault_stopped_by_watchpoint; ops->to_stopped_data_address = tdefault_stopped_data_address; + ops->to_rcmd = default_rcmd; ops->to_can_async_p = find_default_can_async_p; ops->to_is_async_p = find_default_is_async_p; ops->to_async = tdefault_async; diff --git a/gdb/target.c b/gdb/target.c index ba8ca23dc36..3782e7c88bf 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -55,6 +55,8 @@ static int default_watchpoint_addr_within_range (struct target_ops *, static int default_region_ok_for_hw_watchpoint (struct target_ops *, CORE_ADDR, int); +static void default_rcmd (struct target_ops *, char *, struct ui_file *); + static void tcomplain (void) ATTRIBUTE_NORETURN; static int nomemory (CORE_ADDR, char *, int, int, struct target_ops *); @@ -648,7 +650,7 @@ update_current_target (void) INHERIT (to_thread_name, t); INHERIT (to_stop, t); /* Do not inherit to_xfer_partial. */ - INHERIT (to_rcmd, t); + /* Do not inherit to_rcmd. */ INHERIT (to_pid_to_exec_file, t); INHERIT (to_log_command, t); INHERIT (to_stratum, t); @@ -827,9 +829,6 @@ update_current_target (void) de_fault (to_stop, (void (*) (struct target_ops *, ptid_t)) target_ignore); - de_fault (to_rcmd, - (void (*) (struct target_ops *, char *, struct ui_file *)) - tcomplain); de_fault (to_pid_to_exec_file, (char *(*) (struct target_ops *, int)) return_null); @@ -5053,17 +5052,16 @@ static char targ_desc[] = stack of targets currently in use (including the exec-file,\n\ core-file, and process, if any), as well as the symbol file name."; +static void +default_rcmd (struct target_ops *self, char *command, struct ui_file *output) +{ + error (_("\"monitor\" command not supported by this target.")); +} + static void do_monitor_command (char *cmd, int from_tty) { - if ((current_target.to_rcmd - == (void (*) (struct target_ops *, char *, struct ui_file *)) tcomplain) - || (current_target.to_rcmd == debug_to_rcmd - && (debug_target.to_rcmd - == (void (*) (struct target_ops *, - char *, struct ui_file *)) tcomplain))) - error (_("\"monitor\" command not supported by this target.")); target_rcmd (cmd, gdb_stdtarg); } diff --git a/gdb/target.h b/gdb/target.h index b3f8a8e6a70..bd33b4c6bd4 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -528,7 +528,8 @@ struct target_ops char *(*to_thread_name) (struct target_ops *, struct thread_info *); void (*to_stop) (struct target_ops *, ptid_t); void (*to_rcmd) (struct target_ops *, - char *command, struct ui_file *output); + char *command, struct ui_file *output) + TARGET_DEFAULT_FUNC (default_rcmd); char *(*to_pid_to_exec_file) (struct target_ops *, int pid); void (*to_log_command) (struct target_ops *, const char *); struct target_section_table *(*to_get_section_table) (struct target_ops *);