Psetbkpt, Pdelbkpt, Pxecbkpt, Psetwapt, Pdelwapt, Pxecwapt - deal with breakpoints and watchpoints
#include <libproc.h>
int Psetbkpt(ps_prochandle_t *Pr, uintptr_t address, ulong_t *saved);
int Pdelbkpt(ps_prochandle_t *Pr, uintptr_t address, ulong_t saved);
int Pxecbkpt(ps_prochandle_t *Pr, ulong_t saved);
int Psetwapt(ps_prochandle_t *Pr, const prwatch_t *wp);
int Pdelwapt(ps_prochandle_t *Pr, const prwatch_t *wp);
int Pxecwapt(ps_prochandle_t *Pr, const prwatch_t *wp);
The Pr argument identifies a live victim process attached to the controlling process by the create and grab interfaces. For more information, see the Pcreate(3PROC) and Pgrab(3PROC) man pages.
The Psetbkpt() function sets a breakpoint in the address space of the victim process at the location specified by the address argument. The machine instruction that was at the specified address before the breakpoint was inserted, is returned in the location specified by the saved argument.
The Pdelbkpt() function replaces the breakpoint instruction in the address space of the victim process, at the location specified by the address argument by the machine instruction in the saved argument (almost always from a previous call to the Psetbkpt() function).
The Pxecbkpt() function causes the victim process to execute the saved instruction at the current stopped location, which may have stopped due to an encounter with a breakpoint trap, and to stop again before executing the next machine instruction. It replaces the breakpoint instruction at the current stopped location with the saved instruction, then single-steps the victim process, and restores the breakpoint instruction.
The Psetwapt() function sets a watched area described by the wp argument in the address space of the victim process. For more information, see the proc(5) man page.
The Pdelwapt() function deletes the watched area described by the wp argument from the address space of the victim process.
If the victim process is stopped due to a watchpoint trap in the area described by the wp argument, the Pxecwapt() function removes the watched area from the address space of the victim process, single-steps the victim process, and restores the watched area to the address space of the victim process, leaving the victim process stopped before executing the next machine instruction.
On successful completion, all of these functions return 0. On error, they return -1 and set errno to indicate the error.
On failure, these errno values may be set:
Process has been lost to control, needs the Preopen() function
Process is not stopped on a breakpoint or a watchpoint
Signal received while performing the operation
The victim process has terminated
See attributes(7) for descriptions of the following attributes:
|
libproc.h(3HEAD), libproc(3LIB), Pcreate(3PROC), Pgrab(3PROC), proc(5)