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

NAME


Psetbkpt - set a breakpoint trap in a process

LIBRARY


Process Control Library (libproc, -lproc)

SYNOPSIS


#include <libproc.h>

int
Psetbkpt(struct ps_prochandle *P, uintptr_t address, ulong_t *saved);

DESCRIPTION


The Psetbkpt() function sets a breakpoint instruction at the address
address in the process handle P. The instruction that used to be set will
be set in saved and should be retained.

A breakpoint will remain in place until a subsequent call to
Pdelbkpt(3PROC). The value stored in saved should be passed as the third
argument to Pdelbkpt(3PROC).

When a process executes an instruction that has been replaced with a
breakpoint it generates a FLTBPT trap causing the thread to stop.

Note, breakpoints may only be set in active processes. They may not be set
in process handles that refer to core files, zombie processes, or files.

RETURN VALUES


Upon successful completion, the Psetbkpt() function sets the breakpoint and
returns 0. Otherwise, -1 is returned and errno is set to indicate the
error.

ERRORS


For a full list of possible errors see the DIAGNOSTICS section in proc(5).

The Psetbkpt() function will fail if:

ENOENT P does not refer to an active process.

EBUSY A breakpoint instruction was already written by another
debugger.

INTERFACE STABILITY


Uncommitted

MT-LEVEL
See LOCKING in libproc(3LIB).

SEE ALSO


libproc(3LIB), Pdelbkpt(3PROC), proc(5)

illumos May 11, 2016 illumos