convert to_thread_name
authorTom Tromey <tromey@redhat.com>
Wed, 18 Dec 2013 17:49:35 +0000 (10:49 -0700)
committerTom Tromey <tromey@redhat.com>
Wed, 19 Feb 2014 14:47:29 +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_thread_name.
(target_thread_name): Unconditionally delegate.
* target.h (struct target_ops) <to_thread_name>: Use
TARGET_DEFAULT_RETURN.

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

index a4ccc9c..3a5b4d7 100644 (file)
@@ -2,6 +2,15 @@
 
        * target-delegates.c: Rebuild.
        * target.c (update_current_target): Don't inherit or default
+       to_thread_name.
+       (target_thread_name): Unconditionally delegate.
+       * target.h (struct target_ops) <to_thread_name>: Use
+       TARGET_DEFAULT_RETURN.
+
+2014-02-19  Tom Tromey  <tromey@redhat.com>
+
+       * target-delegates.c: Rebuild.
+       * target.c (update_current_target): Don't inherit or default
        to_extra_thread_info.
        * target.h (struct target_ops) <to_extra_thread_info>: Use
        TARGET_DEFAULT_RETURN.
index a6643d1..6658ee9 100644 (file)
@@ -439,6 +439,19 @@ tdefault_extra_thread_info (struct target_ops *self, struct thread_info *arg1)
   return 0;
 }
 
+static char *
+delegate_thread_name (struct target_ops *self, struct thread_info *arg1)
+{
+  self = self->beneath;
+  return self->to_thread_name (self, arg1);
+}
+
+static char *
+tdefault_thread_name (struct target_ops *self, struct thread_info *arg1)
+{
+  return 0;
+}
+
 static void
 delegate_rcmd (struct target_ops *self, char *arg1, struct ui_file *arg2)
 {
@@ -576,6 +589,8 @@ install_delegators (struct target_ops *ops)
     ops->to_has_exited = delegate_has_exited;
   if (ops->to_extra_thread_info == NULL)
     ops->to_extra_thread_info = delegate_extra_thread_info;
+  if (ops->to_thread_name == NULL)
+    ops->to_thread_name = delegate_thread_name;
   if (ops->to_rcmd == NULL)
     ops->to_rcmd = delegate_rcmd;
   if (ops->to_can_async_p == NULL)
@@ -630,6 +645,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_extra_thread_info = tdefault_extra_thread_info;
+  ops->to_thread_name = tdefault_thread_name;
   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;
index d721451..3797090 100644 (file)
@@ -645,7 +645,7 @@ update_current_target (void)
       /* Do not inherit to_find_new_threads.  */
       /* Do not inherit to_pid_to_str.  */
       /* Do not inherit to_extra_thread_info.  */
-      INHERIT (to_thread_name, t);
+      /* Do not inherit to_thread_name.  */
       INHERIT (to_stop, t);
       /* Do not inherit to_xfer_partial.  */
       /* Do not inherit to_rcmd.  */
@@ -735,9 +735,6 @@ update_current_target (void)
   de_fault (to_can_run,
            (int (*) (struct target_ops *))
            return_zero);
-  de_fault (to_thread_name,
-           (char *(*) (struct target_ops *, struct thread_info *))
-           return_null);
   de_fault (to_stop,
            (void (*) (struct target_ops *, ptid_t))
            target_ignore);
@@ -2673,15 +2670,7 @@ target_pid_to_str (ptid_t ptid)
 char *
 target_thread_name (struct thread_info *info)
 {
-  struct target_ops *t;
-
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
-    {
-      if (t->to_thread_name != NULL)
-       return (*t->to_thread_name) (t, info);
-    }
-
-  return NULL;
+  return current_target.to_thread_name (&current_target, info);
 }
 
 void
index 342a99f..73075ae 100644 (file)
@@ -553,7 +553,8 @@ struct target_ops
     char *(*to_pid_to_str) (struct target_ops *, ptid_t);
     char *(*to_extra_thread_info) (struct target_ops *, struct thread_info *)
       TARGET_DEFAULT_RETURN (0);
-    char *(*to_thread_name) (struct target_ops *, struct thread_info *);
+    char *(*to_thread_name) (struct target_ops *, struct thread_info *)
+      TARGET_DEFAULT_RETURN (0);
     void (*to_stop) (struct target_ops *, ptid_t);
     void (*to_rcmd) (struct target_ops *,
                     char *command, struct ui_file *output)