Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Java Development User Guide
Previous Page Home Next Page

Managing conditional breakpoints

A conditional expression can be applied to a line breakpoint such that the breakpoint suspends execution of a thread in one of these cases:

  • when the result of the expression is true
  • when the result of the expression changes

A conditional expression can contain arbitrary Java code and may contain more than one statement, allowing breakpoint conditions to implement features like tracing. For example, a condition can execute a print statement and then return a hard coded value to never suspend ("System.out.println(...); return false;").

To set a condition on a breakpoint:

  1. Find the breakpoint to which an enabling condition is to be applied (in the Breakpoints View or in the editor marker bar).
  2. From the breakpoint's pop-up menu, select Breakpoint Properties... .  The Breakpoint properties dialog will open.
  3. In the properties dialog, check the Enable Condition checkbox. 
  4. In the Condition field enter the expression for the breakpoint condition.
  5. Do one of the following:
    • If you want the breakpoint to stop every time the condition evaluates to true, select the condition is 'true' option.  The expression provided must be a boolean expression.
    • If you want the breakpoint to stop only when the result of the condition changes, select the value of condition changes option.
  6. Select OK to close the dialog and commit the changes. While the breakpoint is enabled, thread execution suspends before that line of code is executed if the breakpoint condition evaluates to true

A conditional breakpoint has a question mark overlay on the breakpoint icon.

Related concepts
Debugger
Java perspectives
Java editor

Related tasks
Adding breakpoints
Applying hit counts
Catching Java exceptions
Removing breakpoints
Setting method breakpoints
Stepping through the execution of a program

Related reference
Breakpoints view

 


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire