Get a list of the active breakpoints for the process associated with the file descriptor.
#include <sys/procfs.h> #define DCMD_PROC_GET_BREAKLIST32 (__DIOF(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 28, procfs_break32)) #define DCMD_PROC_GET_BREAKLIST64 (__DIOF(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 28, procfs_break64)) #define DCMD_PROC_GET_BREAKLIST (__DIOF(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 28, 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_GET_BREAKLIST |
dev_data_ptr | NULL, or an array of procfs_break structures |
n_bytes | 0, or the size of the array |
dev_info_ptr | A pointer to an integer where the number of breakpoints can be stored |
Call this the first time with an argument of NULL to get the number of breakpoints:
devctl( fd, DCMD_PROC_GET_BREAKLIST, NULL, 0, &n);
The total number of breakpoints returned is provided as the extra field. Next, allocate a buffer that's large enough to hold a procfs_break structure (see debug_break_t in <sys/debug.h>) for each breakpoint, and pass it to another devctl() call:
my_buffer = (procfs_break *) malloc( sizeof(procfs_break) * n ); if ( my_buffer == NULL ) { /* Not enough memory. */ } devctl( fd, DCMD_PROC_GET_BREAKLIST, my_buffer, sizeof(procfs_break) * n, &dummy);
To set or clear breakpoints, use DCMD_PROC_BREAK.