* aix-thread.c (giter_count): Do not count the main thread.
authorJoel Brobecker <brobecker@gnat.com>
Wed, 20 May 2009 18:21:20 +0000 (18:21 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Wed, 20 May 2009 18:21:20 +0000 (18:21 +0000)
        (giter_accum): Do not include the main thread.

gdb/ChangeLog
gdb/aix-thread.c

index 3eb2ecde8dbc05860b0ebabbff9cc1dd37a9df3e..beeb7074813a5715b7920e905af19623a123a9cc 100644 (file)
@@ -1,3 +1,8 @@
+2009-05-20  Joel Brobecker  <brobecker@adacore.com>
+
+       * aix-thread.c (giter_count): Do not count the main thread.
+       (giter_accum): Do not include the main thread.
+
 2009-05-19  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        Remove the PROT parameter from openp.
index 1eeeadb6d4fc3919a2115034fcef204533295639..35103f59ff7a1ab93c0bcf8aa6189588a9e0ba50 100644 (file)
@@ -570,22 +570,36 @@ pcmp (const void *p1v, const void *p2v)
   return p1->pthid < p2->pthid ? -1 : p1->pthid > p2->pthid;
 }
 
-/* iterate_over_threads() callback for counting GDB threads.  */
+/* iterate_over_threads() callback for counting GDB threads.
+
+   Do not count the main thread (whose tid is zero).  This matches
+   the list of threads provided by the pthreaddebug library, which
+   does not include that main thread either, and thus allows us
+   to compare the two lists.  */
 
 static int
 giter_count (struct thread_info *thread, void *countp)
 {
-  (*(int *) countp)++;
+  if (PD_TID (thread->ptid))
+    (*(int *) countp)++;
   return 0;
 }
 
-/* iterate_over_threads() callback for accumulating GDB thread pids.  */
+/* iterate_over_threads() callback for accumulating GDB thread pids.
+
+   Do not include the main thread (whose tid is zero).  This matches
+   the list of threads provided by the pthreaddebug library, which
+   does not include that main thread either, and thus allows us
+   to compare the two lists.  */
 
 static int
 giter_accum (struct thread_info *thread, void *bufp)
 {
-  **(struct thread_info ***) bufp = thread;
-  (*(struct thread_info ***) bufp)++;
+  if (PD_TID (thread->ptid))
+    {
+      **(struct thread_info ***) bufp = thread;
+      (*(struct thread_info ***) bufp)++;
+    }
   return 0;
 }
 
This page took 0.043326 seconds and 4 git commands to generate.