Memory access API functions

int purify_assert_is_readable (const char *addr, int size)

Simulates a read of size bytes starting at address  addr, generating any ABR, BSR, FMR, IPR, MSE, NPR, SBR, UMR, WPR or ZPR errors that read would cause and calling purify_stop_here. Returns 0 if errors are detected, and returns 1 if no errors are detected.

int purify_assert_is_writable (const char *addr, int size)

Simulates a write of size bytes starting at address  addr, generating any ABW, BSW, FMW, IPW, MSE, NPW, SBW, WPW, or ZPW errors that write would cause and calling purify_stop_here. Returns 0 if errors are detected, and returns 1 if no errors are detected.

int purify_describe (char *addr)

Prints specific details about the memory pointed to by addr, including its location (stack, heap, text) and, for heap memory, the call chains of its allocation and free history.

Returns the pointer passed to it.

int  purify_what_colors (char *addr, unsigned int  size)

Prints out the memory state of size bytes starting at memory address addr. The memory state of each byte of memory is represented by one of the letters "R," "G," "B," or "Y," corresponding to the colors red, green, blue, and yellow respectively.

Unallocated, uninitialized memory is red. When it is allocated but not yet initialized, it is yellow. Once written or initialized, it is green. When freed, uninitialized memory turns from yellow to red, while initialized memory turns from green to blue.

(gdb) print purify_what_colors(buf, sizeof(buf))
color codes of 8 bytes at 0xefffee1c:GGGGYYYY

 

Notes: