about summary refs log tree commit diff
path: root/linuxthreads_db/td_thr_getgregs.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-11-02 23:44:42 +0000
committerUlrich Drepper <drepper@redhat.com>1999-11-02 23:44:42 +0000
commita9cb398f7b2a6a8549ec33cdcc99f510566d3819 (patch)
tree03683c10060e9a77ed564004e04fa4e8c043db5d /linuxthreads_db/td_thr_getgregs.c
parent03fc7ab6ed4bc2f71964a3d31ad578821256b6bc (diff)
downloadglibc-a9cb398f7b2a6a8549ec33cdcc99f510566d3819.tar.gz
glibc-a9cb398f7b2a6a8549ec33cdcc99f510566d3819.tar.xz
glibc-a9cb398f7b2a6a8549ec33cdcc99f510566d3819.zip
Update.
1999-11-02  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/i386/sys/procfs.h: Include sys/ucontext.h
	instead of duplicating definitions.
Diffstat (limited to 'linuxthreads_db/td_thr_getgregs.c')
-rw-r--r--linuxthreads_db/td_thr_getgregs.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/linuxthreads_db/td_thr_getgregs.c b/linuxthreads_db/td_thr_getgregs.c
index e8a87b1bcc..549c7d8b83 100644
--- a/linuxthreads_db/td_thr_getgregs.c
+++ b/linuxthreads_db/td_thr_getgregs.c
@@ -28,12 +28,16 @@ td_thr_getgregs (const td_thrhandle_t *th, prgregset_t gregs)
 
   LOG (__FUNCTION__);
 
-  /* We have to get the PID for this thread.  */
+  /* We have to get the state and the PID for this thread.  */
   if (ps_pdread (th->th_ta_p->ph, th->th_unique, &pds,
 		 sizeof (struct _pthread_descr_struct)) != PS_OK)
     return TD_ERR;
 
-  if (ps_lgetregs (th->th_ta_p->ph, pds.p_pid, gregs) != PS_OK)
+  /* If the thread already terminated we return all zeroes.  */
+  if (pds.p_terminated)
+    memset (gregs, '\0', sizeof (gregs));
+  /* Otherwise get the register content through the callback.  */
+  else if (ps_lgetregs (th->th_ta_p->ph, pds.p_pid, gregs) != PS_OK)
     return TD_ERR;
 
   return TD_OK;