about summary refs log tree commit diff
path: root/linuxthreads_db/td_thr_get_info.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-10-14 00:40:29 +0000
committerUlrich Drepper <drepper@redhat.com>1999-10-14 00:40:29 +0000
commit00e50680b1f067cfbbf46619138567314f5877d9 (patch)
treebb7c3429840b29b5ba23cbb6cae7d17dd72f8f86 /linuxthreads_db/td_thr_get_info.c
parent252470b60ff30bcb3b97bd8af81ced2ad8196342 (diff)
downloadglibc-00e50680b1f067cfbbf46619138567314f5877d9.tar.gz
glibc-00e50680b1f067cfbbf46619138567314f5877d9.tar.xz
glibc-00e50680b1f067cfbbf46619138567314f5877d9.zip
Update.
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.
Diffstat (limited to 'linuxthreads_db/td_thr_get_info.c')
-rw-r--r--linuxthreads_db/td_thr_get_info.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/linuxthreads_db/td_thr_get_info.c b/linuxthreads_db/td_thr_get_info.c
index 61d0b9ead5..973323e1d6 100644
--- a/linuxthreads_db/td_thr_get_info.c
+++ b/linuxthreads_db/td_thr_get_info.c
@@ -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;
 }