12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #include "thread_dbP.h"
- td_err_e
- td_thr_getgregs (const td_thrhandle_t *th, prgregset_t gregs)
- {
- struct _pthread_descr_struct pds;
- LOG ("td_thr_getgregs");
- if (th->th_unique == NULL)
- {
-
- pid_t 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;
- }
-
- if (ps_pdread (th->th_ta_p->ph, th->th_unique, &pds,
- sizeof (struct _pthread_descr_struct)) != PS_OK)
- return TD_ERR;
-
- if (pds.p_terminated)
- memset (gregs, '\0', sizeof (prgregset_t));
-
- 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;
- }
|