Miscellaneous API functions

int  purify_is_running (void)

Returns 1 if the executable is Purify'd, 0 otherwise. You can use this function to enclose special purpose application code to execute in the Purify'd environment. For example:

if (purify_is_running()) {
    install_gui_leaks_button();
 }

You can also use this function to wrap around calls to other Purify API functions so that they are not called when your program is not instrumented.  For example:

if (purify_is_running())

{
purify_printf("Note this part of the code.");
purify_describe(my_ptr);
purify_what_colors(my_ptr, 24);

}

Notes:

  • It is safe to call these functions in uninstrumented programs because the stubs library handles them, but using purify_is_running improves runtime performance, in proportion to the number of Purify API functions that you call.

  • An alternative to calling purify_is_running is to use the compile-time directive #ifdef PURIFY; however, the run-time cost of dialing purify_is_running is negligible, and #ifdef  requires that you re-compile your program with the -DPURIFY flag set.

int purify_stop_here (void)

Set a breakpoint on purify_stop_here to cause your debugger to stop on every Purify error message after Purify reports the message but just before the error actually occurs. This allows you to look at the information Purify provides and to examine the environment before an error such as an ABW occurs and corrupts memory.

Note that you cannot call purify_stop_here directly from your program to break execution at a specific point. To do this, you must call purify_stop_here_internal in your code, and set a breakpoint on purify_stop_here.

For an example of how to use this function, click

int purify_stop_here_internal (void)

Use this function if you want to trigger a purify_stop_here from within your code. Note that you have to set a breakpoint on purify_stop_here in your debugger for this to work.