DCMD_PROC_RUN
Resume the process that's associated with the file descriptor, if it has previously been stopped.
#include <sys/procfs.h>
#define DCMD_PROC_RUN (__DIOT(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 9, procfs_run))
The arguments to devctl() are:
Argument | Value |
---|---|
filedes | A file descriptor for the process. You must have opened the file descriptor for writing. |
dcmd | DCMD_PROC_RUN |
dev_data_ptr | A pointer to a procfs_run structure |
n_bytes | sizeof(procfs_run) |
dev_info_ptr | NULL |
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), NULL);
The procfs_run or debug_run_t structure is defined for 64-bit architectures as follows:
typedef struct _debug_run64 {
uint32_t flags;
pthread_t tid;
sigset_t trace;
sigset_t hold;
fltset_t fault;
uintptr32_t __ip;
uintptr64_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.