convert to_can_run
authorTom Tromey <tromey@redhat.com>
Fri, 20 Dec 2013 19:19:37 +0000 (12:19 -0700)
committerTom Tromey <tromey@redhat.com>
Wed, 19 Feb 2014 14:48:40 +0000 (07:48 -0700)
2014-02-19  Tom Tromey  <tromey@redhat.com>

* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_can_run.
(find_default_run_target): Check against delegate_can_run.
* target.h (struct target_ops) <to_can_run>: Use
TARGET_DEFAULT_RETURN.

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

index 18792c6c52ce50cef2aecb5f8eadafe0d8a33f16..9db4fd456df3a13bf2a331e042e27f7282884456 100644 (file)
@@ -1,3 +1,12 @@
+2014-02-19  Tom Tromey  <tromey@redhat.com>
+
+       * target-delegates.c: Rebuild.
+       * target.c (update_current_target): Don't inherit or default
+       to_can_run.
+       (find_default_run_target): Check against delegate_can_run.
+       * target.h (struct target_ops) <to_can_run>: Use
+       TARGET_DEFAULT_RETURN.
+
 2014-02-19  Tom Tromey  <tromey@redhat.com>
 
        * target-delegates.c: Rebuild.
index 1565c78bdc88e73220990792c71a92e3ac303818..0ffee5a8b2e4f7914cc68dfea2e0354428e4f572 100644 (file)
@@ -530,6 +530,19 @@ delegate_mourn_inferior (struct target_ops *self)
   self->to_mourn_inferior (self);
 }
 
+static int
+delegate_can_run (struct target_ops *self)
+{
+  self = self->beneath;
+  return self->to_can_run (self);
+}
+
+static int
+tdefault_can_run (struct target_ops *self)
+{
+  return 0;
+}
+
 static void
 delegate_pass_signals (struct target_ops *self, int arg1, unsigned char *arg2)
 {
@@ -1639,6 +1652,8 @@ install_delegators (struct target_ops *ops)
     ops->to_has_exited = delegate_has_exited;
   if (ops->to_mourn_inferior == NULL)
     ops->to_mourn_inferior = delegate_mourn_inferior;
+  if (ops->to_can_run == NULL)
+    ops->to_can_run = delegate_can_run;
   if (ops->to_pass_signals == NULL)
     ops->to_pass_signals = delegate_pass_signals;
   if (ops->to_program_signals == NULL)
@@ -1857,6 +1872,7 @@ install_dummy_methods (struct target_ops *ops)
   ops->to_set_syscall_catchpoint = tdefault_set_syscall_catchpoint;
   ops->to_has_exited = tdefault_has_exited;
   ops->to_mourn_inferior = default_mourn_inferior;
+  ops->to_can_run = tdefault_can_run;
   ops->to_pass_signals = tdefault_pass_signals;
   ops->to_program_signals = tdefault_program_signals;
   ops->to_thread_alive = tdefault_thread_alive;
index bf93220b446b1571ddb3f3ce83e168a01a3a1403..13b2e65292593c8db8eafbaa6c429c4794ea032f 100644 (file)
@@ -653,7 +653,7 @@ update_current_target (void)
       /* Do not inherit to_set_syscall_catchpoint.  */
       /* Do not inherit to_has_exited.  */
       /* Do not inherit to_mourn_inferior.  */
-      INHERIT (to_can_run, t);
+      /* Do not inherit to_can_run.  */
       /* Do not inherit to_pass_signals.  */
       /* Do not inherit to_program_signals.  */
       /* Do not inherit to_thread_alive.  */
@@ -748,9 +748,6 @@ update_current_target (void)
            (int (*) (CORE_ADDR, gdb_byte *, int, int,
                      struct mem_attrib *, struct target_ops *))
            nomemory);
-  de_fault (to_can_run,
-           (int (*) (struct target_ops *))
-           return_zero);
   current_target.to_read_description = NULL;
 
 #undef de_fault
@@ -2852,7 +2849,7 @@ find_default_run_target (char *do_mesg)
   for (t = target_structs; t < target_structs + target_struct_size;
        ++t)
     {
-      if ((*t)->to_can_run && target_can_run (*t))
+      if ((*t)->to_can_run != delegate_can_run && target_can_run (*t))
        {
          runable = *t;
          ++count;
index 1ceb74d099ad1e2d41a151622f310ad5df8442ae..ec15e5b0d4a25ce9132da3b644a1a3fa0e4e198b 100644 (file)
@@ -547,7 +547,8 @@ struct target_ops
       TARGET_DEFAULT_RETURN (0);
     void (*to_mourn_inferior) (struct target_ops *)
       TARGET_DEFAULT_FUNC (default_mourn_inferior);
-    int (*to_can_run) (struct target_ops *);
+    int (*to_can_run) (struct target_ops *)
+      TARGET_DEFAULT_RETURN (0);
 
     /* Documentation of this routine is provided with the corresponding
        target_* macro.  */
This page took 0.030526 seconds and 4 git commands to generate.