Annotation API functions

Note: These functions are variations on purify_printf, which supports the simple conversion characters %d, %u, %n, %s, %c, %e, %f, and %g, but not the full % conversion-character syntax of printf. No field width or precision specifiers are allowed. The %e, %f, %g characters are equivalent to %10.2f.

 

int purify_printf (char *fmt, ...)

Prints formatted output from the program to the Viewer, stderr, or log file if set.

int purify_printf_with_call_chain (char *fmt, ...)

Prints formatted output and the current call chain to the Viewer, stderr, or log file if set. For example:

if (detect_error) {
    purify_printf_with_call_chain(
        "Found bad input value %d\n", in_val);
 }

This example displays the specified string and the function-call sequence to this point. This might help track errant function-call requests without stepping through the debugger. In this manner, the function purify_printf_with_call_chain extends the power of debugging using printf.

A call to this function counts as an error, and triggers mail if -mail-to-user is set.

int purify_logfile_printf (char *fmt...)

Prints formatted output from the program to the log file if the -log-file option is set. If -log-file is not set this function does nothing.