Exit processing options

Option

Default

-exit-status

no

Enables you to control the exit status of your Purify'd program, based upon the Purify results. If Purify detects unsuppressed access errors, leaks, or potential leaks, the additional bits are OR'd into the exit status of the program.

Unsuppressed error        Bit OR'd in exit status

Memory access errors      0x40
Memory leaks                    0x20
Potential memory leaks      0x10

 

-run-at-exit

not set

Specifies an arbitrary shell command to be run when your program exits or otherwise terminates. In addition to the %V, %v, and %p filename conversion characters, Purify recognizes these exit-command conversion characters:

%z     String value "true" or "false" indicating whether
         any call chains were printed (for example, in
         error or leak reports)
%x
     Program's exit status (0 if the program did not
         call exit)
%e
     Number of distinct access errors printed
%E
     Total number of errors printed
%l
     Number of bytes of memory leaked
%L
     Number of bytes of memory potentially leaked

For example, if you set the option:
setenv PURIFYOPTIONS '-run-at-exit="if %z ; then \
 echo \"%v: %e errors, %l+%L bytes leaked.\" ; fi"'

When your program exits, you might see on stdout:
testprog: 2 errors, 1+10 bytes leaked.

 

Other options related to program exit are:

You can also run shell scripts at exit.