]> sourceware.org Git - glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Thu, 14 Oct 1999 00:40:29 +0000 (00:40 +0000)
committerUlrich Drepper <drepper@redhat.com>
Thu, 14 Oct 1999 00:40:29 +0000 (00:40 +0000)
1999-10-13  Ulrich Drepper  <drepper@cygnus.com>

* td_ta_thr_iter.c: Use size of descriptor from *TA.
Don't return manager thread before it's actually running.
Actually use state parameter to distingusih at least a few states.

* td_thr_get_info.c: Handle manager thread special.  Fill in ti_lid,
ti_state fields, and ti_startfunc fields.

ChangeLog
linuxthreads_db/ChangeLog
linuxthreads_db/td_ta_thr_iter.c
linuxthreads_db/td_thr_get_info.c

index 57c38f08800abb5b5aa4459408e3824a1937781b..6680a847c5e7ad153a3c18264e43abd6b9e6ca7d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+1999-10-13  Ulrich Drepper  <drepper@cygnus.com>
+
+       * td_ta_thr_iter.c: Use size of descriptor from *TA.
+       Don't return manager thread before it's actually running.
+       Actually use state parameter to distingusih at least a few states.
+
+       * td_thr_get_info.c: Handle manager thread special.  Fill in ti_lid,
+       ti_state fields, and ti_startfunc fields.
+
 1999-10-12  Ulrich Drepper  <drepper@cygnus.com>
 
        * sysdeps/unix/sysv/linux/i386/sys/ucontext.h: Don't define
index 6c952c1be0661f321c68d8b22c084191c9a01c27..defa1e6c7b82f82b1a4e2d29851e3f8b32a75b2a 100644 (file)
@@ -1,3 +1,12 @@
+1999-10-13  Ulrich Drepper  <drepper@cygnus.com>
+
+       * td_ta_thr_iter.c: Use size of descriptor from *TA.
+       Don't return manager thread before it's actually running.
+       Actually use state parameter to distingusih at least a few states.
+
+       * td_thr_get_info.c: Handle manager thread special.  Fill in ti_lid,
+       ti_state fields, and ti_startfunc fields.
+
 1999-10-12  Andreas Jaeger  <aj@suse.de>
 
        * thread_dbP.h: Include <string.h> for strlen declaration.  Remove
index e25230c2b418491e119ea946a35203f5d805d8f8..678dd7f01b86d8194ff98af396d300d1594e7a79 100644 (file)
@@ -28,6 +28,7 @@ td_ta_thr_iter (const td_thragent_t *ta, td_thr_iter_f *callback,
 {
   struct pthread_handle_struct *handles = ta->handles;
   int pthread_threads_max = ta->pthread_threads_max;
+  size_t sizeof_descr = ta->sizeof_descr;
   int cnt;
 
   LOG (__FUNCTION__);
@@ -46,10 +47,16 @@ td_ta_thr_iter (const td_thragent_t *ta, td_thr_iter_f *callback,
          struct _pthread_descr_struct pds;
          td_thrhandle_t th;
 
-         if (ps_pdread (ta->ph, phc.h_descr, &pds,
-                        sizeof (struct _pthread_descr_struct)) != PS_OK)
+         if (ps_pdread (ta->ph, phc.h_descr, &pds, sizeof_descr) != PS_OK)
            return TD_ERR;      /* XXX Other error value?  */
 
+         /* The manager thread must be handled special.  The descriptor
+            exists but the thread only gets created when the first
+            `pthread_create' call is issued.  A clear indication that
+            this happened is when the p_pid field is non-zero.  */
+         if (cnt == 1 && pds.p_pid == 0)
+           continue;
+
          /* Now test whether this thread matches the specified
             conditions.  */
 
@@ -57,6 +64,13 @@ td_ta_thr_iter (const td_thragent_t *ta, td_thr_iter_f *callback,
          if (pds.p_priority < ti_pri)
            continue;
 
+         /* Test the state.
+            XXX This is incomplete.  */
+         if (state != TD_THR_ANY_STATE
+             && (state != TD_THR_ZOMBIE || pds.p_exited == 0)
+             && (state != TD_THR_RUN || pds.p_exited != 0))
+           continue;
+
          /* Yep, it matches.  Call the callback function.  */
          th.th_ta_p = (td_thragent_t *) ta;
          th.th_unique = phc.h_descr;
index 61d0b9ead5fa340ed008355d03072b393cc93147..973323e1d69c84c954a7f04c8c0c7948f9e20529 100644 (file)
@@ -39,21 +39,33 @@ td_thr_get_info (const td_thrhandle_t *th, td_thrinfo_t *infop)
      results for the fields we do not fill in.  */
   memset (infop, '\0', sizeof (td_thrinfo_t));
 
-  infop->ti_ta_p = th->th_ta_p;
-  infop->ti_tid = pds.p_tid;
-  infop->ti_tls = (char *) pds.p_specific;
-  infop->ti_pri = pds.p_priority;
-  /* The first thread (0 being the initial one) is the manager thread
-     Mark it appropriately.  */
-  infop->ti_type = ((pds.p_tid % th->th_ta_p->pthread_threads_max) == 1
-                   ? TD_THR_SYSTEM : TD_THR_USER);
-
-  /* We can get the following information only if the thread descriptor
-     in the target processor is large enough, i.e., comes from a recent
-     enough library.  */
-  if (offsetof (struct _pthread_descr_struct, p_startfct)
-      < th->th_ta_p->sizeof_descr)
-    infop->ti_startfunc = pds.p_startfct;
+  /* We have to handle the manager thread special since the thread
+     descriptor in older versions is not fully initialized.  */
+  if (pds.p_nr == 1)
+    {
+      infop->ti_ta_p = th->th_ta_p;
+      infop->ti_tid = th->th_ta_p->pthread_threads_max * 2 + 1;
+      infop->ti_lid = pds.p_pid;
+      infop->ti_type = TD_THR_SYSTEM;
+      infop->ti_state = TD_THR_RUN;
+    }
+  else
+    {
+      infop->ti_ta_p = th->th_ta_p;
+      infop->ti_tid = pds.p_tid;
+      infop->ti_lid = pds.p_pid;
+      infop->ti_tls = (char *) pds.p_specific;
+      infop->ti_pri = pds.p_priority;
+      infop->ti_type = TD_THR_USER;
+
+      if (pds.p_exited)
+       infop->ti_state = TD_THR_ZOMBIE;
+      else
+       /* XXX For now there is no way to get more information.  */
+       infop->ti_state = TD_THR_RUN;
+
+      infop->ti_startfunc = pds.p_start_args.start_routine;
+    }
 
   return TD_OK;
 }
This page took 0.050419 seconds and 5 git commands to generate.