There is a very useful feature in many IDEs, that makes bug fixing much easier. I'm talking about conditional breakpoints. But unfortunately in Eclipse IDE its location is quite unintuitive
So to put conditional breakpoint you should:
- Put usual breakpoint. It may be done by clicking on the left margin of the editor or pressing Ctrl+Shift+B while you're on the line.
|
Figure 1. Breakpoint marker in the left margin of the editor |
- Right click on the breakpoint marker int the editor's left margin and select "Breakpoint properties..."
- In the appeared window tick "Conditional" and enter your condition in the editor. Note that key assist is available in this editor.
|
Figure 2. Breakpoint properties window configured for conditional breakpoint |
- If you want to stop every time expression returns true then select "Suspend when 'true'"
- If you want to stop only when expression changes its value then select "Suspend when value changes"
- Press OK. Note the breakpoint marker has changed.
|
Figure 3. Conditional breakpoint marker in the left margin of the editor |