2011-09-13 Pedro Alves <pedro@codesourcery.com>
authorPedro Alves <palves@redhat.com>
Tue, 13 Sep 2011 19:27:01 +0000 (19:27 +0000)
committerPedro Alves <palves@redhat.com>
Tue, 13 Sep 2011 19:27:01 +0000 (19:27 +0000)
* inferior.h (ALL_INFERIORS): New.
* linux-thread-db.c (thread_db_find_new_threads_2): Remove check
for a stopped thread.
(thread_db_find_new_threads): Look for threads in all inferiors.

gdb/ChangeLog
gdb/inferior.h
gdb/linux-thread-db.c

index 7cec15e4f93784890a7be1cc4bdfc716306b0fe1..fcb60b9ae2b677ac94e9e54132e7957eacb0649e 100644 (file)
@@ -1,3 +1,10 @@
+2011-09-13  Pedro Alves  <pedro@codesourcery.com>
+
+       * inferior.h (ALL_INFERIORS): New.
+       * linux-thread-db.c (thread_db_find_new_threads_2): Remove check
+       for a stopped thread.
+       (thread_db_find_new_threads): Look for threads in all inferiors.
+
 2011-09-13  Pedro Alves  <pedro@codesourcery.com>
 
        * breakpoint.c (update_watchpoint): Handle the case of the
index cf747a650cd60251835276f205a67dde0b9b2bfc..0815b65e9e1c5275c940d4b7d5b549ec53092113 100644 (file)
@@ -615,6 +615,11 @@ extern void set_current_inferior (struct inferior *);
 
 extern struct cleanup *save_current_inferior (void);
 
+/* Traverse all inferiors.  */
+
+#define ALL_INFERIORS(I) \
+  for ((I) = inferior_list; (I); (I) = (I)->next)
+
 extern struct inferior *inferior_list;
 
 /* Prune away automatically added inferiors that aren't required
index 8141b203b2a79f2d67f304ff20623042175dda0e..8dd766b2512915d166394b9b4ce93faaa5dac5ce 100644 (file)
@@ -1552,20 +1552,6 @@ thread_db_find_new_threads_2 (ptid_t ptid, int until_no_new)
   int pid = ptid_get_pid (ptid);
   int i, loop;
 
-  if (target_has_execution)
-    {
-      struct lwp_info *lp;
-
-      /* In linux, we can only read memory through a stopped lwp.  */
-      ALL_LWPS (lp, ptid)
-       if (lp->stopped && ptid_get_pid (lp->ptid) == pid)
-         break;
-
-      if (!lp)
-       /* There is no stopped thread.  Bail out.  */
-       return;
-    }
-
   info = get_thread_db_info (GET_PID (ptid));
 
   /* Access an lwp we know is stopped.  */
@@ -1607,13 +1593,25 @@ static void
 thread_db_find_new_threads (struct target_ops *ops)
 {
   struct thread_db_info *info;
+  struct inferior *inf;
 
-  info = get_thread_db_info (GET_PID (inferior_ptid));
+  ALL_INFERIORS (inf)
+    {
+      struct thread_info *thread;
 
-  if (info == NULL)
-    return;
+      if (inf->pid == 0)
+       continue;
 
-  thread_db_find_new_threads_1 (inferior_ptid);
+      info = get_thread_db_info (inf->pid);
+      if (info == NULL)
+       continue;
+
+      thread = any_live_thread_of_process (inf->pid);
+      if (thread == NULL || thread->executing)
+       continue;
+
+      thread_db_find_new_threads_1 (thread->ptid);
+    }
 
   if (target_has_execution)
     iterate_over_lwps (minus_one_ptid /* iterate over all */,
This page took 0.035923 seconds and 4 git commands to generate.