Eclipse tip: Watch points

When debugging it is sometimes interesting to know when a variable is accessed or modified. Watch point is special breakpoints which does exactly this. A watch point will suspend execution when a specified variable is accessed or modified.

To add/remove a watch point, right click on any variable in the outline view and choose the “Toggle Watchpoint” option.

Toggle Watchpoint

The watch point now appears in the Breakpoints view. The watch point can be configured to suspend only when the variable is accessed or only when it is modified. Right click on the watch point and choose “Properties…” to change these settings. Thread filtering and hit counter are also available.

Watch point options