Go to main content

man pages section 3: Extended Library Functions, Volume 3

Exit Print View

Updated: Thursday, June 13, 2019
 
 

Psetbkpt (3PROC)

Name

Psetbkpt, Pdelbkpt, Pxecbkpt, Psetwapt, Pdelwapt, Pxecwapt - deal with breakpoints and watchpoints

Synopsis

#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);

Description

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.

Return Values

On successful completion, all of these functions return 0. On error, they return -1 and set errno to indicate the error.

Errors

On failure, these errno values may be set:

EAGAIN

Process has been lost to control, needs the Preopen() function

EBUSY

Process is not stopped on a breakpoint or a watchpoint

EINTR

Signal received while performing the operation

ENOENT

The victim process has terminated

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
Unsafe

See Also

libproc.h(3HEAD), libproc(3LIB), Pcreate(3PROC), Pgrab(3PROC), proc(5)