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

Psetbkpt
set a breakpoint trap in a process

Process Control Library (libproc, -lproc)

#include <libproc.h>
int
Psetbkpt(struct ps_prochandle *P, uintptr_t address, ulong_t *saved);

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.

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

For a full list of possible errors see the DIAGNOSTICS section in proc(4).
The Psetbkpt() function will fail if:
 
 
P does not refer to an active process.
 
 
A breakpoint instruction was already written by another debugger.

Uncommitted

See LOCKING in libproc(3LIB).

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