convert to_pid_to_str
authorTom Tromey <tromey@redhat.com>
Wed, 18 Dec 2013 21:46:03 +0000 (14:46 -0700)
committerTom Tromey <tromey@redhat.com>
Wed, 19 Feb 2014 14:48:15 +0000 (07:48 -0700)
2014-02-19  Tom Tromey  <tromey@redhat.com>

* target-delegates.c: Rebuild.
* target.c (target_pid_to_str): Unconditionally delegate.
(init_dummy_target): Don't initialize to_pid_to_str.
(default_pid_to_str): Rename from dummy_pid_to_str.
* target.h (struct target_ops) <to_pid_to_str>: Use
TARGET_DEFAULT_FUNC.

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

index bcc47b9..2512cbc 100644 (file)
@@ -1,6 +1,15 @@
 2014-02-19  Tom Tromey  <tromey@redhat.com>
 
        * target-delegates.c: Rebuild.
+       * target.c (target_pid_to_str): Unconditionally delegate.
+       (init_dummy_target): Don't initialize to_pid_to_str.
+       (default_pid_to_str): Rename from dummy_pid_to_str.
+       * target.h (struct target_ops) <to_pid_to_str>: Use
+       TARGET_DEFAULT_FUNC.
+
+2014-02-19  Tom Tromey  <tromey@redhat.com>
+
+       * target-delegates.c: Rebuild.
        * target.c (target_find_new_threads): Unconditionally delegate.
        * target.h (struct target_ops) <to_find_new_threads>: Use
        TARGET_DEFAULT_RETURN.
index 781167a..fe827fa 100644 (file)
@@ -554,6 +554,13 @@ tdefault_find_new_threads (struct target_ops *self)
 }
 
 static char *
+delegate_pid_to_str (struct target_ops *self, ptid_t arg1)
+{
+  self = self->beneath;
+  return self->to_pid_to_str (self, arg1);
+}
+
+static char *
 delegate_extra_thread_info (struct target_ops *self, struct thread_info *arg1)
 {
   self = self->beneath;
@@ -1298,6 +1305,8 @@ install_delegators (struct target_ops *ops)
     ops->to_program_signals = delegate_program_signals;
   if (ops->to_find_new_threads == NULL)
     ops->to_find_new_threads = delegate_find_new_threads;
+  if (ops->to_pid_to_str == NULL)
+    ops->to_pid_to_str = delegate_pid_to_str;
   if (ops->to_extra_thread_info == NULL)
     ops->to_extra_thread_info = delegate_extra_thread_info;
   if (ops->to_thread_name == NULL)
@@ -1458,6 +1467,7 @@ install_dummy_methods (struct target_ops *ops)
   ops->to_pass_signals = tdefault_pass_signals;
   ops->to_program_signals = tdefault_program_signals;
   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;
   ops->to_thread_name = tdefault_thread_name;
   ops->to_stop = tdefault_stop;
index 59c593f..53a8e2b 100644 (file)
@@ -89,6 +89,8 @@ static int dummy_find_memory_regions (struct target_ops *self,
 static char *dummy_make_corefile_notes (struct target_ops *self,
                                        bfd *ignore1, int *ignore2);
 
+static char *default_pid_to_str (struct target_ops *ops, ptid_t ptid);
+
 static int find_default_can_async_p (struct target_ops *ignore);
 
 static int find_default_is_async_p (struct target_ops *ignore);
@@ -2540,15 +2542,7 @@ target_wait (ptid_t ptid, struct target_waitstatus *status, int options)
 char *
 target_pid_to_str (ptid_t ptid)
 {
-  struct target_ops *t;
-
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
-    {
-      if (t->to_pid_to_str != NULL)
-       return (*t->to_pid_to_str) (t, ptid);
-    }
-
-  return normal_pid_to_str (ptid);
+  return (*current_target.to_pid_to_str) (&current_target, ptid);
 }
 
 char *
@@ -3500,7 +3494,7 @@ normal_pid_to_str (ptid_t ptid)
 }
 
 static char *
-dummy_pid_to_str (struct target_ops *ops, ptid_t ptid)
+default_pid_to_str (struct target_ops *ops, ptid_t ptid)
 {
   return normal_pid_to_str (ptid);
 }
@@ -3536,7 +3530,6 @@ init_dummy_target (void)
   dummy_target.to_supports_non_stop = find_default_supports_non_stop;
   dummy_target.to_supports_disable_randomization
     = find_default_supports_disable_randomization;
-  dummy_target.to_pid_to_str = dummy_pid_to_str;
   dummy_target.to_stratum = dummy_stratum;
   dummy_target.to_has_all_memory = (int (*) (struct target_ops *)) return_zero;
   dummy_target.to_has_memory = (int (*) (struct target_ops *)) return_zero;
index 7b36e48..29d210a 100644 (file)
@@ -561,7 +561,8 @@ struct target_ops
     int (*to_thread_alive) (struct target_ops *, ptid_t ptid);
     void (*to_find_new_threads) (struct target_ops *)
       TARGET_DEFAULT_IGNORE ();
-    char *(*to_pid_to_str) (struct target_ops *, ptid_t);
+    char *(*to_pid_to_str) (struct target_ops *, ptid_t)
+      TARGET_DEFAULT_FUNC (default_pid_to_str);
     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 *)