Watchpoint API functions

Note: Calling any of the API functions to set watchpoints adds the watchpoint to your <program>.watchpoints file. For more information about setting watchpoints, click

 

int  purify_watch (char *addr)
int  purify_watch_<num> (char *addr) <num>=1,2,4,8
int  purify_watch_w_<num> (char *addr) <num>=1,2,4,8

These functions specify watchpoints that detect writes, allocations, deallocations, and entry and exit of memory addresses. The purify_watch_<num> and purify_watch_w_<num> functions are identical. You can specify watchpoints for variables of 1, 2, 4, and 8 bytes. The purify_watch function watches 4 bytes.

(gdb) print purify_watch_1(&my_char)
(dbx) print purify_watch_w_8(my_double_ptr)
(xdb) p purify_watch_1(&my_char)

These functions return the number assigned to the watchpoint.

int  purify_watch_r_<num> (char *addr) <num>=1,2,4,8

Specifies a watchpoint that detects reads, allocations, deallocations, and entry and exit of memory addresses. Use to specify watchpoints for variables of 1, 2, 4, and 8 bytes.

(gdb) print purify_watch_r_1(&read_only_char)

This function returns the number assigned to the watchpoint.

int  purify_watch_rw_<num> (char *addr) <num>=1,2,4,8

Specifies a watchpoint that detects reads, writes, allocations, deallocations, and entry and exit of memory addresses. <num>=1, 2, 4, or 8. You can specify watchpoints for variables of 1, 2, 4, and 8 bytes.

(gdb) print purify_watch_rw_1(&rw_char)

This function returns the number assigned to the watchpoint.

int   purify_watch_n (char  *addr, unsigned int size, char *type)

Sets a watchpoint on an arbitrary-sized buffer.
addr
specifies the address of the beginning of the buffer.
 size specifies the number of bytes to watch.
 type specifies whether to watch for reads ("r"), writes ("w"), or both ("rw").

(gdb) print purify_watch_n(buf, sizeof(buf), "rw")
(dbx) print purify_watch_n(write_only_buf,100,"w")

This function returns the number assigned to the watchpoint.

For interactive use, it is sometimes easier to call purify_watch_n with
type = 1
, 2, or 3 instead of r, w, or rw respectively.

int  purify_watch_info (void)

Lists all the active watchpoints and returns 0.

int  purify_watch_remove (int watchno)
int  purify_watch_remove_all (void)

The function purify_watch_remove permanently removes from the <program>.watchpoints file the watchpoint specified by watchno. watchno is a watchpoint number as returned by purify_watch* functions, or as identified in the <program>.watchpoints file.

The function purify_watch_remove_all removes all watchpoints.