DCMD_PROC_RUN

Resume the process that's associated with the file descriptor, if it has previously been stopped.

You must have opened the file descriptor for writing. To stop the process, use DCMD_PROC_STOP .

The DCMD_PROC_RUN command also lets you set the "points of interest" (e.g. signals or faults you want to stop on) and other run flags (e.g. instruction pointer or single-step).

The argument is a pointer to a procfs_run structure (see debug_run_t in <sys/debug.h>). This structure is passed on as control information to the process before it resumes. For example:

procfs_run      run;

memset( &run, 0, sizeof(run) );
run.flags |= _DEBUG_RUN_CLRFLT | _DEBUG_RUN_CLRSIG;
devctl( fd, DCMD_PROC_RUN, &run, sizeof(run), 0);
  

The procfs_run or debug_run_t structure is defined as follows:

typedef struct _debug_run {
    uint32_t                    flags;
    pthread_t                   tid;
    sigset_t                    trace;
    sigset_t                    hold;
    fltset_t                    fault;
    uintptr_t                   ip;
} debug_run_t;

The members include:

flags
A combination of zero or more of the following bits:
  • _DEBUG_RUN_CLRSIG — clear pending signal.
  • _DEBUG_RUN_CLRFLT — clear pending fault.
  • _DEBUG_RUN_TRACE — the trace mask flags interesting signals.
  • _DEBUG_RUN_FAULT — the fault mask flags interesting faults.
  • _DEBUG_RUN_VADDR — change ip before running.
  • _DEBUG_RUN_STEP — single-step only one thread.
  • _DEBUG_RUN_STEP_ALL — single-step one thread; other threads run.
  • _DEBUG_RUN_CURTID — change the current thread (target thread) to the one whose thread ID is specified by tid.
  • _DEBUG_RUN_ARM — deliver an event at the point of interest. Use the DCMD_PROC_EVENT command to define the event.
tid
The ID of the thread that you want to become the current thread, for use with _DEBUG_RUN_CURTID.
trace
A set of signals (SIG*) to trace, for use with _DEBUG_RUN_TRACE.
hold
Not currently used.
fault
A set of faults (FLT*) to trace, for use with _DEBUG_RUN_FAULT.
ip
The new value for the instruction pointer, for use with _DEBUG_RUN_VADDR.

Use sigemptyset() and sigaddset() to build the set of signals or faults for the trace, hold and fault members.