about summary refs log tree commit diff
path: root/linuxthreads_db/td_thr_getfpregs.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-04-05 02:21:01 +0000
committerUlrich Drepper <drepper@redhat.com>2001-04-05 02:21:01 +0000
commite2700a69f4af8f00c2dc963676a5af77aeb5e691 (patch)
tree680c57953e33e51f1ff14c6d201469894e128d06 /linuxthreads_db/td_thr_getfpregs.c
parentf18ec00f67c0135c76b668c87e84ccc448a4d978 (diff)
downloadglibc-e2700a69f4af8f00c2dc963676a5af77aeb5e691.tar.gz
glibc-e2700a69f4af8f00c2dc963676a5af77aeb5e691.tar.xz
glibc-e2700a69f4af8f00c2dc963676a5af77aeb5e691.zip
If p_pid is zero use ps_getpid().
Diffstat (limited to 'linuxthreads_db/td_thr_getfpregs.c')
-rw-r--r--linuxthreads_db/td_thr_getfpregs.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/linuxthreads_db/td_thr_getfpregs.c b/linuxthreads_db/td_thr_getfpregs.c
index e6635d2644..68a36d505d 100644
--- a/linuxthreads_db/td_thr_getfpregs.c
+++ b/linuxthreads_db/td_thr_getfpregs.c
@@ -1,5 +1,5 @@
 /* Get a thread's floating-point register set.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 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_getfpregs (const td_thrhandle_t *th, prfpregset_t *regset)
   if (pds.p_terminated)
     memset (regset, '\0', sizeof (*regset));
   /* Otherwise get the register content through the callback.  */
-  else if (ps_lgetfpregs (th->th_ta_p->ph, pds.p_pid, regset) != PS_OK)
-    return TD_ERR;
+  else
+    {
+      pid_t pid = pds.p_pid ?: ps_getpid (th->th_ta_p->ph);
+
+      if (ps_lgetfpregs (th->th_ta_p->ph, pid, regset) != PS_OK)
+	return TD_ERR;
+    }
 
   return TD_OK;
 }