Saving watchpoints

When a   watchpoint function is called to set a watchpoint, Purify automatically saves the watchpoint in the file ./<programname>.watchpoints. Purify writes this file to the current directory as you set the watchpoints, then reads it when you restart the program.

You can override where Purify reads and writes this file by setting the -watchpoints-file=<filename> option:

-watchpoints-file=$HOME/wps

You can use conversion characters in <programname>.

To stop Purify from automatically saving watchpoints, set the -watchpoints-file option to an empty file name:

-watchpoints-file=

Calling any of the following API functions adds an entry to your watchpoints file:

purify_watch
purify_watch_w_<n>
purify_watch_r_<n>
purify_watch_rw_<n>
purify_watch_n

To remove the saved watchpoints, you can either delete the <programname>.watchpoints file before executing the program, or call the function purify_watch_remove_all, which removes all the watchpoints and the <programname>.watchpoints file. Calling purify_watch_remove removes entries from your watchpoints file.

The watchpoints file

Each entry in the watchpoint file has the form:

watch <address> <length> <type_as_num> # <watchnum> <type_as_string>

<type_as_num> is 0, 1, or 2, and represents <type_as_string>, which is "r," "w," and "rw."

For example, the following watch directive watches 4 bytes starting at 0xffbeec68:

watch 0xffbeec68 4 2 # 1 "w"

The values for <watchnum> and <type_as_string> after "#" are comments.

A watchpoint, in concept, may be tied to a particular symbolic reference in your program (purify_wqtch(&my_var)), but to Purify they are tied to a specific address in a specific instantiation of your program. For this reason, existing watchpoints are almost always invalidated every time you link your program. Purify does not reuse a watchpoint file if your application has a more recent modification date. Instead, Purify renames the file to <watchpoints_file>.bak.

If you edit your watchpoints file directly, Purify will see it as out of date with respect to your executable and will not use it. You can get around this by touch'ing your executable after editing your watchpoints file.