summaryrefslogtreecommitdiff
path: root/linuxthreads_db/td_thr_getgregs.c
diff options
context:
space:
mode:
Diffstat (limited to 'linuxthreads_db/td_thr_getgregs.c')
-rw-r--r--linuxthreads_db/td_thr_getgregs.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/linuxthreads_db/td_thr_getgregs.c b/linuxthreads_db/td_thr_getgregs.c
index a4d861970e..a95fcaf13c 100644
--- a/linuxthreads_db/td_thr_getgregs.c
+++ b/linuxthreads_db/td_thr_getgregs.c
@@ -1,5 +1,5 @@
/* Get a thread's general register set.
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
@@ -37,8 +37,13 @@ td_thr_getgregs (const td_thrhandle_t *th, prgregset_t gregs)
if (pds.p_terminated)
memset (gregs, '\0', sizeof (prgregset_t));
/* 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;
+ else
+ {
+ pid_t pid = pds.p_pid ?: ps_getpid (th->th_ta_p->ph);
+
+ if (ps_lgetregs (th->th_ta_p->ph, pid, gregs) != PS_OK)
+ return TD_ERR;
+ }
return TD_OK;
}