cc [ flag ... ] file ... -lthread_db [ library ... ] #include <proc_service.h> #include <thread_db.h>td_err_e td_thr_getgregs(const td_thrhandle_t *th_p, prgregset_tgregset);
These routines read and write the register sets associated with thread th_p. td_thr_getgregs() and td_thr_setgregs() get and set, respectively, the general registers of thread th_p. td_thr_getfpregs() and td_thr_setfpregs() get and set, respectively, the thread's floating point register set. td_thr_getxregsize(), td_thr_getxregs(), and td_thr_setxregs() are SPARC-specific. td_thr_getxregsize() returns in *xregsize the size of the architecture-dependent extra state registers. td_thr_getxregs() and td_thr_setxregs() get and set, respectively, those extra state registers. On non-SPARC architectures, these routines return TD_NOXREGS.
If thread th_p is currently executing on a lightweight process ( LWP), these routines will read or write, respectively, the appropriate register set to the LWP using the imported interface. If the thread is not currently executing on a LWP, then the floating point and extra state registers may not be read or written. Some of the general registers may also not be readable or writable, depending on the architecture. In this case, td_thr_getfpregs() and td_thr_setfpregs() will return TD_NOFPREGS, and td_thr_getxregs() and td_thr_setxregs() will return TD_NOXREGS. Calls to td_thr_getgregs() and td_thr_setgregs() will succeed, but values returned for unreadable registers will be undefined, and values specified for unwritable registers will be ignored. In this instance, a value of TD_PARTIALREGS will be returned. See the architecture-specific notes that follow regarding the registers that may be read and written for a thread not currently executing on a LWP.
On a thread not currently assigned to a LWP, only %i0-%i7, %l0-%l7, %g7, %pc, and %sp (%o6) may be read or written. %pc and %sp refer to the program counter and stack pointer that the thread will have when it resumes execution.
On a thread not currently assigned to a LWP, only %pc, %sp, %ebp, %edi, %edi, and %ebx may be read.
The call completed successfully.
An invalid thread handle was passed in.
A call to one of the imported interface routines failed.
Because the thread is not currently assigned to a LWP, not all registers were read or written. See DESCRIPTION for a discussion about which registers are not saved when a thread is not assigned to an LWP.
Floating point registers could not be read or written, either because the thread is not currently assigned to an LWP, or because the architecture does not have such registers.
Architecture-dependent extra state registers could not be read or written, either because the thread is not currently assigned to an LWP, or because the architecture does not have such registers, or because the architecture is not a SPARC architecture.
A libthread_db internal error occurred.
See attributes(5) for description of the following attributes:
|ATTRIBUTE TYPE||ATTRIBUTE VALUE|