From a9cb398f7b2a6a8549ec33cdcc99f510566d3819 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 2 Nov 1999 23:44:42 +0000 Subject: Update. 1999-11-02 Ulrich Drepper * sysdeps/unix/sysv/linux/i386/sys/procfs.h: Include sys/ucontext.h instead of duplicating definitions. --- linuxthreads_db/td_thr_getgregs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'linuxthreads_db/td_thr_getgregs.c') diff --git a/linuxthreads_db/td_thr_getgregs.c b/linuxthreads_db/td_thr_getgregs.c index e8a87b1..549c7d8 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; -- cgit v1.1