Define an event to be delivered when the process associated with the file descriptor reaches a point of interest.

#include <sys/procfs.h>

#define DCMD_PROC_EVENT  __DIOT(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 17, struct sigevent)

The arguments to devctl() are:

Argument Value
filedes A file descriptor for the process.
dev_data_ptr A pointer to a struct sigevent
n_bytes sizeof(struct sigevent)
dev_info_ptr NULL

Use the DCMD_PROC_RUN command to set up the point of interest.

Note: The DCMD_PROC_EVENT command won't work unless you've set _DEBUG_RUN_ARM in the flags field of the procfs_run structure for the DCMD_PROC_RUN command.

Unlike DCMD_PROC_WAITSTOP, the DCMD_PROC_EVENT command doesn't block the calling process.

The argument is a pointer to the sigevent that you want to be delivered at the appropriate time. For example:

struct sigevent     event;

// Define a sigevent for process stopped notification.
event.sigev_notify = SIGEV_SIGNAL_THREAD;
event.sigev_signo = SIGUSR2;
event.sigev_code = 0;
event.sigev_value.sival_ptr = prp;
event.sigev_priority = -1;
devctl( fd, DCMD_PROC_EVENT, &event, sizeof(event), NULL);