convert to_rcmd

2014-02-19  Tom Tromey  <tromey@redhat.com>

	* 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) <to_rmcd>: Use
	TARGET_DEFAULT_FUNC.
This commit is contained in:
Tom Tromey 2013-12-18 09:35:21 -07:00
parent e9a2920092
commit a53f36250e
4 changed files with 31 additions and 12 deletions

View File

@ -1,3 +1,13 @@
2014-02-19 Tom Tromey <tromey@redhat.com>
* 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) <to_rmcd>: Use
TARGET_DEFAULT_FUNC.
2014-02-19 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.

View File

@ -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;

View File

@ -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);
}

View File

@ -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 *);