diff options
author | Ulrich Drepper <drepper@redhat.com> | 2001-04-05 02:21:01 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2001-04-05 02:21:01 +0000 |
commit | e2700a69f4af8f00c2dc963676a5af77aeb5e691 (patch) | |
tree | 680c57953e33e51f1ff14c6d201469894e128d06 /linuxthreads_db | |
parent | f18ec00f67c0135c76b668c87e84ccc448a4d978 (diff) | |
download | glibc-e2700a69f4af8f00c2dc963676a5af77aeb5e691.zip glibc-e2700a69f4af8f00c2dc963676a5af77aeb5e691.tar.gz glibc-e2700a69f4af8f00c2dc963676a5af77aeb5e691.tar.bz2 |
If p_pid is zero use ps_getpid().
Diffstat (limited to 'linuxthreads_db')
-rw-r--r-- | linuxthreads_db/td_thr_getfpregs.c | 11 | ||||
-rw-r--r-- | linuxthreads_db/td_thr_getgregs.c | 11 | ||||
-rw-r--r-- | linuxthreads_db/td_thr_setfpregs.c | 12 | ||||
-rw-r--r-- | linuxthreads_db/td_thr_setgregs.c | 12 |
4 files changed, 32 insertions, 14 deletions
diff --git a/linuxthreads_db/td_thr_getfpregs.c b/linuxthreads_db/td_thr_getfpregs.c index e6635d2..68a36d5 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; } diff --git a/linuxthreads_db/td_thr_getgregs.c b/linuxthreads_db/td_thr_getgregs.c index a4d8619..a95fcaf 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; } diff --git a/linuxthreads_db/td_thr_setfpregs.c b/linuxthreads_db/td_thr_setfpregs.c index 0c426b3..144c850 100644 --- a/linuxthreads_db/td_thr_setfpregs.c +++ b/linuxthreads_db/td_thr_setfpregs.c @@ -1,5 +1,5 @@ /* 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. @@ -34,9 +34,13 @@ td_thr_setfpregs (const td_thrhandle_t *th, const prfpregset_t *fpregs) 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; } diff --git a/linuxthreads_db/td_thr_setgregs.c b/linuxthreads_db/td_thr_setgregs.c index 72f95b1..50da111 100644 --- a/linuxthreads_db/td_thr_setgregs.c +++ b/linuxthreads_db/td_thr_setgregs.c @@ -1,5 +1,5 @@ /* 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. @@ -34,9 +34,13 @@ td_thr_setgregs (const td_thrhandle_t *th, prgregset_t gregs) 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; } |