/* 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.
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;
}
/* 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.
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;
}
/* Set 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.
return TD_ERR;
/* Only set the registers if the thread hasn't yet terminated. */
- if (pds.p_terminated == 0
- && ps_lsetfpregs (th->th_ta_p->ph, pds.p_pid, fpregs) != PS_OK)
- return TD_ERR;
+ if (pds.p_terminated == 0)
+ {
+ pid_t pid = pds.p_pid ?: ps_getpid (th->th_ta_p->ph);
+
+ if (ps_lsetfpregs (th->th_ta_p->ph, pid, fpregs) != PS_OK)
+ return TD_ERR;
+ }
return TD_OK;
}
/* Set a thread's general 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.
return TD_ERR;
/* Only set the registers if the thread hasn't yet terminated. */
- if (pds.p_terminated == 0
- && ps_lsetregs (th->th_ta_p->ph, pds.p_pid, gregs) != PS_OK)
- return TD_ERR;
+ if (pds.p_terminated == 0)
+ {
+ pid_t pid = pds.p_pid ?: ps_getpid (th->th_ta_p->ph);
+
+ if (ps_lsetregs (th->th_ta_p->ph, pid, gregs) != PS_OK)
+ return TD_ERR;
+ }
return TD_OK;
}