convert to_rcmd
authorTom Tromey <tromey@redhat.com>
Wed, 18 Dec 2013 16:35:21 +0000 (09:35 -0700)
committerTom Tromey <tromey@redhat.com>
Wed, 19 Feb 2014 14:47:01 +0000 (07:47 -0700)
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.

gdb/ChangeLog
gdb/target-delegates.c
gdb/target.c
gdb/target.h

index 06e26353cae9cb75cc5536911181d9d7017b08c2..0ccd337ba92abdfca5b8f75f221af7fab613d9b5 100644 (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.
index 119d3ec8f5efa8b4b0f1b3f2e0f2e75342777824..b2547c0af6b0c0e7ac02f9e3ee4ab07b1676d4a1 100644 (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;
index ba8ca23dc3681938a8a2a00015ad2e04c7fa6d8d..3782e7c88bf00adb762346f35941c2695aed36d2 100644 (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);
 }
 
index b3f8a8e6a708a71d751e108d6d0b04814fd87714..bd33b4c6bd4ced8837fd2131803e64e34b9e0505 100644 (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 *);
This page took 0.032312 seconds and 4 git commands to generate.