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

Vasanth Dharmaraj is a Java Architect currently working for Western Union living in the Bay Area. He is interested in programming, gadgets, formula one... You can follow him on Twitter.

Posted in Eclipse, Java

Ads By Google