DCMD_PROC_BREAK

QNX SDP8.0Programmer's GuideDeveloper

Set or remove a breakpoint or watchpoint in the process that's associated with the file descriptor.

#include <sys/procfs.h>

#define DCMD_PROC_BREAK    (__DIOTF(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 14, procfs_break))

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_BREAK
dev_data_ptr A pointer to a procfs_break structure
n_bytes sizeof(procfs_break)
dev_info_ptr NULL

The argument is a pointer to a procfs_break structure (see debug_break_t in <sys/debug.h>) that specifies the breakpoint to be set or removed. For example:

procfs_break        brk;

memset(&brk, 0, sizeof brk);
brk.type = _DEBUG_BREAK_EXEC;
brk.addr = acc->break_addr.offset;
brk.size = 0;
devctl(fd, DCMD_PROC_BREAK, &brk, sizeof brk, 0);

To set a breakpoint, use a size of 0 in the procfs_break structure. Additionally, to set a watchpoint, specify the width of the watchpoint area through the size field in the procfs_break structure, which ranges from 1 to 8 bytes. A size of -1 is used to delete either a breakpoint or a watchpoint.

The types of breakpoints; one of the following:
  • _DEBUG_BREAK_EXEC — execution breakpoint.
  • _DEBUG_BREAK_RD — read access watchpoint.
  • _DEBUG_BREAK_WR — write access watchpoint.
  • _DEBUG_BREAK_RW — read or write access watchpoint.
  • _DEBUG_BREAK_MODIFY — memory modified watchpoint.
  • _DEBUG_BREAK_RDM — read access watchpoint if supported; otherwise downgraded.
  • _DEBUG_BREAK_WRM — write access watchpoint if supported; otherwise downgraded.
  • _DEBUG_BREAK_RWM — read or write access watchpoint if supported; otherwise downgraded.
Note:
  • Unsupported access modes with no close behavioral approximation are rejected with an error. Otherwise, a supported approximation is made from the requested access mode.
  • Breakpoints other than _DEBUG_BREAK_EXEC are highly dependent on the hardware. In many architectures, other types of breakpoints cause the kernel to make the process run in single-step, checking the watchpoints each time, which can be very slow.
Page updated: