-
how to use purify
#> setenv PURIFYOPTIONS "-chain-length=40 -cache-dir=/tmp"
#> make LD="purify g++" -
get Purify release
#> purify -version
-
displays Purify options
#> purify -options
-
display the Purify options used to generate the binary
#> purify_what_options <binary>
-
workaround to see the code lines with Purify 5.3 on Solaris 8
CC -xs -g
-
options:
-follow-child-processes=yes
follow and check the child processes (this is not the case by default) -chain-length=40
specifies the number of recorded stack frames (default 6) -cache-dir=/tmp
specifies the cache directory -always-use-cache-dir
stores purified files in cache directory instead of alongside original ones -
by default Purify does not log alarm signals, to log them
-handle-signals=SIGALRM
-
display a message in the Purify window if the program is tested with Purify, in
stderr
otherwise
Create a filepurify_stub.c
// default routines definition (necessary to be able to link without Purify)
extern "C" int purify_is_running(void);
extern "C" int purify_printf_with_call_chain(const char *fmt,…);
int purify_is_running() { return 0;}
int purify_printf_with_call_chain(const char*,…) { return 0;}
…
extern "C" int purify_is_running(void);
extern "C" int purify_printf_with_call_chain(const char *fmt,…);
…
if (purify_is_running()) {
purify_printf_with_call_chain("%s",message);
} else {
printf(stderr,"%s",message);
}