blob: daede2ecf53569ccbaa7e54d24a116506cbdd7bb [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding watchpoints</title>
<link rel="stylesheet" type="text/css" href="../help.css">
</head>
<body>
<h1>Adding watchpoints</h1>
<p>A watchpoint is a special breakpoint that stops the execution of an
application whenever the value of a given expression changes, without specifying
where this may happen. Unlike breakpoints which are line-specific watchpoints
are associated with files. They take effect whenever a specified condition is
true regardless of when or where it occurred.</p>
<p>To add a watchpoint:</p>
<ol>
<li>Click <b>Run &gt; Add C/C++ Watchpoint</b>.</li>
<ol>
<li>If <b>Add C/C++ Watchpoint</b> is not listed on the Run menu, select <b>Window
&gt; Customize Perspective</b>.</li><li>In the Customize Perspective dialog
box, expand <b>Other</b> in the <b>Available Items</b> list.</li><li>Select the <b>C/C++ Debug</b> check box. Click <b>OK</b>.</li>
</ol>
<li>In the <b>Add C/C++ Watchpoint</b> dialog box, type an expression in the <b>Expression to watch</b>
box. The
expression may be anything that can be evaluated inside an <samp>if</samp>
statement.</li>
<li>Do any of the following:</li>
<ul><li>To stop execution when the watch expression is read, select the
<b>Read</b> check box.</li>
<li>To stop execution when the watch expression is written to, select the <b>Write</b>
check box.</li></ul>
<li>In the C/C++ editor, open the file that you added the watchpoint to.</li>
<li>Click <b>OK</b>.</li>
<li>The watchpoint appears in the <b>Breakpoints</b> view
list.</li>
</ol>
<p><img border="0" src="../images/ngconcepts.gif" ALT="Related concepts" width="143" height="21">
<br>
<a href="../concepts/cdt_c_over_cdt.htm">C/C++ Development perspective</a><br>
<a href="../concepts/cdt_o_projects.htm">Projects</a></p>
<p><img border="0" src="../images/ngtasks.gif" ALT="Related tasks" width="143" height="21">
<br>
<a href="cdt_o_brkpnts_watch.htm">Working with breakpoints and watchpoints</a></p>
<p><img border="0" src="../images/ngref.gif" ALT="Related reference" width="143" height="21">
<br>
<a href="../reference/cdt_o_run_dbg_pages.htm">Run and Debug dialog box</a></p>
<img src="../images/ng03_04.gif" ALT="IBM Copyright Statement" BORDER=0 width="324" height="14">
</body>
</html>