convert to_thread_alive
authorTom Tromey <tromey@redhat.com>
Thu, 19 Dec 2013 14:21:56 +0000 (07:21 -0700)
committerTom Tromey <tromey@redhat.com>
Wed, 19 Feb 2014 14:48:31 +0000 (07:48 -0700)
2014-02-19  Tom Tromey  <tromey@redhat.com>

* target-delegates.c: Rebuild.
* target.c (target_thread_alive): Unconditionally delegate.
* target.h (struct target_ops) <to_thread_alive>: Use
TARGET_DEFAULT_RETURN.

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

index 4dc1725f86ae4752d5d637a3cb3e77fd5a56f30d..363536da61a4639f04e4c7af1ccdffe92bcb8ae4 100644 (file)
@@ -1,3 +1,10 @@
+2014-02-19  Tom Tromey  <tromey@redhat.com>
+
+       * target-delegates.c: Rebuild.
+       * target.c (target_thread_alive): Unconditionally delegate.
+       * target.h (struct target_ops) <to_thread_alive>: Use
+       TARGET_DEFAULT_RETURN.
+
 2014-02-19  Tom Tromey  <tromey@redhat.com>
 
        * target-delegates.c: Rebuild.
index 62f68cc1ecd646d0d9dccd58ae37de1fa0ae276e..0da855aabab33c5089c07f9c6ec96e2d6b446bfb 100644 (file)
@@ -541,6 +541,19 @@ tdefault_program_signals (struct target_ops *self, int arg1, unsigned char *arg2
 {
 }
 
+static int
+delegate_thread_alive (struct target_ops *self, ptid_t arg1)
+{
+  self = self->beneath;
+  return self->to_thread_alive (self, arg1);
+}
+
+static int
+tdefault_thread_alive (struct target_ops *self, ptid_t arg1)
+{
+  return 0;
+}
+
 static void
 delegate_find_new_threads (struct target_ops *self)
 {
@@ -1524,6 +1537,8 @@ install_delegators (struct target_ops *ops)
     ops->to_pass_signals = delegate_pass_signals;
   if (ops->to_program_signals == NULL)
     ops->to_program_signals = delegate_program_signals;
+  if (ops->to_thread_alive == NULL)
+    ops->to_thread_alive = delegate_thread_alive;
   if (ops->to_find_new_threads == NULL)
     ops->to_find_new_threads = delegate_find_new_threads;
   if (ops->to_pid_to_str == NULL)
@@ -1721,6 +1736,7 @@ install_dummy_methods (struct target_ops *ops)
   ops->to_mourn_inferior = default_mourn_inferior;
   ops->to_pass_signals = tdefault_pass_signals;
   ops->to_program_signals = tdefault_program_signals;
+  ops->to_thread_alive = tdefault_thread_alive;
   ops->to_find_new_threads = tdefault_find_new_threads;
   ops->to_pid_to_str = default_pid_to_str;
   ops->to_extra_thread_info = tdefault_extra_thread_info;
index 17077aabba3d830abae09b4d557bd3922bce2f63..d59cea8c2347376a1a42cf5906571eb2f346841e 100644 (file)
@@ -3552,24 +3552,14 @@ target_attach (char *args, int from_tty)
 int
 target_thread_alive (ptid_t ptid)
 {
-  struct target_ops *t;
-
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
-    {
-      if (t->to_thread_alive != NULL)
-       {
-         int retval;
-
-         retval = t->to_thread_alive (t, ptid);
-         if (targetdebug)
-           fprintf_unfiltered (gdb_stdlog, "target_thread_alive (%d) = %d\n",
-                               ptid_get_pid (ptid), retval);
+  int retval;
 
-         return retval;
-       }
-    }
+  retval = current_target.to_thread_alive (&current_target, ptid);
+  if (targetdebug)
+    fprintf_unfiltered (gdb_stdlog, "target_thread_alive (%d) = %d\n",
+                       ptid_get_pid (ptid), retval);
 
-  return 0;
+  return retval;
 }
 
 void
index e3d7ed80b5d3d7dd06f281cb906ce2c385e8a6cb..ecfd1a2d338800f4a8d10e37c17c4b047e5dbad6 100644 (file)
@@ -558,7 +558,8 @@ struct target_ops
     void (*to_program_signals) (struct target_ops *, int, unsigned char *)
       TARGET_DEFAULT_IGNORE ();
 
-    int (*to_thread_alive) (struct target_ops *, ptid_t ptid);
+    int (*to_thread_alive) (struct target_ops *, ptid_t ptid)
+      TARGET_DEFAULT_RETURN (0);
     void (*to_find_new_threads) (struct target_ops *)
       TARGET_DEFAULT_IGNORE ();
     char *(*to_pid_to_str) (struct target_ops *, ptid_t)
This page took 0.032117 seconds and 4 git commands to generate.