Fix undefined behavior in TUI's TAB expansion
[deliverable/binutils-gdb.git] / gdb / nto-procfs.c
index 8a10d3d643701c535f71ec2e9a9230575c65444e..7312060105f2b090e8836939e330ef61b6d8a9ed 100644 (file)
@@ -1,7 +1,7 @@
 /* Machine independent support for QNX Neutrino /proc (process file system)
    for GDB.  Written by Colin Burgess at QNX Software Systems Limited.
 
-   Copyright (C) 2003-2014 Free Software Foundation, Inc.
+   Copyright (C) 2003-2015 Free Software Foundation, Inc.
 
    Contributed by QNX Software Systems Ltd.
 
@@ -247,24 +247,24 @@ update_thread_private_data_name (struct thread_info *new_thread,
   gdb_assert (newname != NULL);
   gdb_assert (new_thread != NULL);
   newnamelen = strlen (newname);
-  if (!new_thread->private)
+  if (!new_thread->priv)
     {
-      new_thread->private = xmalloc (offsetof (struct private_thread_info,
+      new_thread->priv = xmalloc (offsetof (struct private_thread_info,
                                               name)
                                     + newnamelen + 1);
-      memcpy (new_thread->private->name, newname, newnamelen + 1);
+      memcpy (new_thread->priv->name, newname, newnamelen + 1);
     }
-  else if (strcmp (newname, new_thread->private->name) != 0)
+  else if (strcmp (newname, new_thread->priv->name) != 0)
     {
       /* Reallocate if neccessary.  */
-      int oldnamelen = strlen (new_thread->private->name);
+      int oldnamelen = strlen (new_thread->priv->name);
 
       if (oldnamelen < newnamelen)
-       new_thread->private = xrealloc (new_thread->private,
+       new_thread->priv = xrealloc (new_thread->priv,
                                        offsetof (struct private_thread_info,
                                                  name)
                                        + newnamelen + 1);
-      memcpy (new_thread->private->name, newname, newnamelen + 1);
+      memcpy (new_thread->priv->name, newname, newnamelen + 1);
     }
 }
 
@@ -299,7 +299,7 @@ update_thread_private_data (struct thread_info *new_thread,
 
   update_thread_private_data_name (new_thread, tn->name_buf);
 
-  pti = (struct private_thread_info *) new_thread->private;
+  pti = (struct private_thread_info *) new_thread->priv;
   pti->tid = tid;
   pti->state = state;
   pti->flags = flags;
@@ -307,7 +307,7 @@ update_thread_private_data (struct thread_info *new_thread,
 }
 
 static void
-procfs_find_new_threads (struct target_ops *ops)
+procfs_update_thread_list (struct target_ops *ops)
 {
   procfs_status status;
   pid_t pid;
@@ -318,6 +318,8 @@ procfs_find_new_threads (struct target_ops *ops)
   if (ctl_fd == -1)
     return;
 
+  prune_threads ();
+
   pid = ptid_get_pid (inferior_ptid);
 
   status.tid = 1;
@@ -631,7 +633,7 @@ procfs_attach (struct target_ops *ops, const char *args, int from_tty)
   if (!target_is_pushed (ops))
     push_target (ops);
 
-  procfs_find_new_threads (ops);
+  procfs_update_thread_list (ops);
 }
 
 static void
@@ -1195,7 +1197,7 @@ procfs_create_inferior (struct target_ops *ops, char *exec_file,
     close (fds[2]);
 
   inferior_ptid = do_attach (pid_to_ptid (pid));
-  procfs_find_new_threads (ops);
+  procfs_update_thread_list (ops);
 
   inf = current_inferior ();
   inferior_appeared (inf, pid);
@@ -1440,7 +1442,7 @@ init_procfs_targets (void)
   t->to_mourn_inferior = procfs_mourn_inferior;
   t->to_pass_signals = procfs_pass_signals;
   t->to_thread_alive = procfs_thread_alive;
-  t->to_find_new_threads = procfs_find_new_threads;
+  t->to_update_thread_list = procfs_update_thread_list;
   t->to_pid_to_str = procfs_pid_to_str;
   t->to_stop = procfs_stop;
   t->to_have_continuable_watchpoint = 1;
This page took 0.025377 seconds and 4 git commands to generate.