blob: 88ad7787d54cdf3f8c0e95ab548200002fce8875 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" href="../../../book.css" charset="ISO-8859-1" type="text/css">
<title>Breakpoint Condition Option</title>
<link href="../../book.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>Breakpoint Condition Option</h1>
<hr>
<p>Each breakpoint can have a unique condition that determines when the breakpoint will be hit.</p>
<p>A condition for a breakpoint can be any logical expression that evaluates to either true or false.
The expression is evaluated in the scope of the breakpoint location, meaning you cannot make reference to a class, etc., outside the scope of the breakpoint
location when composing your expression. </p>
<p>Consider the following example:</p>
<pre>public class Person {
String name = "";
int age = 0;
public Person(String name, int age) {
this.name = name;
this.age = age; //breakpoint here
}
};</pre>
<p>If we take the above example, place a breakpoint where indicated and go to the breakpoint properties we can add our condition. In this case we limited only to the members of the class the breakpoint is contained in and those provided by Object.</p>
<p>For example a valid condition could be:</p>
<pre> age == 56 </pre>
<p>meaning the breakpoint would only suspend when age was equal to 56.</p>
<p>Conditions can be added to breakpoints using the <a href="../../reference/views/breakpoints/ref-properties_contextaction.htm">breakpoints properties dialog</a> shown below. </p>
<p><img src="../../images/debug_breakpoints_ref/ref-breakpoint_condition.PNG" alt="Breakpoint condition option"></p>
<hr>
<p> <img border="0" src="../../images/ngrelc.png" alt="Related concepts"></p>
<p> <a href="../../concepts/cbrkpnts.htm">Breakpoints</a> </p>
<p> <img border="0" src="../../images/ngrelt.png" alt="Related tasks"> </p>
<p> <a href="../../tasks/tasks-144.htm">Adding breakpoints</a><br>
<a href="../../tasks/tasks-144a.htm">Removing breakpoints</a><br>
<a href="../../tasks/tasks-130.htm">Launching a Java program</a><br>
<a href="../../tasks/tasks-126.htm">Running and debugging</a></p>
<p>&nbsp;</p>
</body>
</html>