PLWP_GETREGS(3PROC) Process Control Library Functions PLWP_GETREGS(3PROC)

Plwp_getfpregs, Plwp_setfpregs, Plwp_getregs, Plwp_setregs
get and set thread registers

Process Control Library (libproc, -lproc)

#include <libproc.h>
int
Plwp_getfpregs(struct ps_prochandle *P, lwpid_t lwpid, prfpregset_t *fpregs);
int
Plwp_setfpregs(struct ps_prochandle *P, lwpid_t lwpid, const prfpregset_t fpregs);
int
Plwp_getregs(struct ps_prochandle *P, lwpid_t lwpid, prpregset_t *gregs);
int
Plwp_setregs(struct ps_prochandle *P, lwpid_t lwpid, const prpregset_t gregs);

The Plwp_getregs(), Plwp_setregs(), Plwp_getfpregs(), and Plwp_setfpregs() functions allow one to get and set the general purpose and floating point registers from the thread lwpid in the process handle P.
The Plwp_getfpregs() function updates the structure pointed to by fpregs with the state and values of the floating point registers of the thread specified by lwpid.
The Plwp_setfpregs() function updates the floating point registers of the thread specified by lwpid to the register state contained in fpregs.
The Plwp_getregs() function updates the structure pointed to by gregs with the state and values of the general purpose registers of the thread specified by lwpid.
The Plwp_setregs() function updates the general purpose registers of the thread specified by lwpid to the register state contained in gregs.
Processes must be stopped before obtaining the register state of individual threads. Processes may be stopped with Pstop(3PROC). The structures used for registers are described in proc(4) and their defintions may be found in <sys/regset.h>. The definitions of these structures varies based on the architecture of the system and the running process.
One may not set the register values of a process that is not an active process, e.g. a process handle that refers to a file or a core file.

Upon successful completion, the Plwp_getregs(), Plwp_setregs(), Plwp_getfpregs(), and Plwp_setfpregs() functions return 0 and obtain or set the register state. Otherwise, -1 is returned, errno is set to indicate the error, and the register state is not updated nor are the data pointers changed.

For a full list of possible errors also see the DIAGNOSTICS section in proc(4).
The Plwp_getregs(), Plwp_setregs(), Plwp_getfpregs(), and Plwp_setfpregs() will fail if:
 
 
The process handle P is not currently stopped.
 
 
There is no thread in P with id lwpid.

Uncommitted

See LOCKING in libproc(3LIB).

libproc(3LIB), proc(4)
May 11, 2016 illumos