TotalView lets you monitor the changes that occur to memory locations by creating a special type of action point called a
watchpoint. You most often use watchpoints to find a statement in your program that is writing to places to which it shouldn’t be writing. This can occur, for example, when processes share memory and more than one process writes to the same location. It can also occur when your program writes off the end of an array or when your program has a dangling pointer.
TotalView watchpoints are called modify watchpoints because TotalView only
triggers a watchpoint when your program modifies a memory location. If a program writes a value into a location that is the same as what is already stored, TotalView doesn’t trigger the watchpoint because the location’s value did not change.
For example, if location 0x10000 has a value of 0 and your program writes a value of 0 to this location, TotalView doesn’t trigger the watchpoint, even though your program wrote data to the memory location. See
“Triggering Watchpoints” for more details on when watchpoints trigger.
You can also create conditional watchpoints. A conditional watchpoint is similar to a conditional breakpoint in that TotalView evaluates the expression when the value in the watched memory location changes. You can use conditional watchpoints for a number of purposes. For example, you can use one to test whether a value changes its sign—that is, it becomes positive or negative—or whether a value moves above or below some threshold value.