| <!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>Debugging your project</title> |
| <link rel="stylesheet" type="text/css" href="../help.css"> |
| </head> |
| |
| <body> |
| |
| <h1>Debugging your project</h1> |
| |
| <p>The debugger lets you control the execution of your program by setting |
| breakpoints, suspending executed programs, stepping through your code, and |
| examining the contents of variables.</p> |
| <p>To debug a project:</p> |
| <ol> |
| <li>Click <b>Run > Debug</b>.<p>The Debug dialog box |
| opens.</li> |
| <li>Double-click <b>C++ Local</b>.</li> |
| <li>In the <b>Name</b> box, type <b>Hello World</b>.</li> |
| <p>You can now select this debug launch configuration by name the next time |
| that you debug this project.</p> |
| <li>In the <b>C/C++ Application</b> box, type <b>hello.exe</b>.</li> |
| <li>Click <b>Debug</b>.</li> |
| <p>The debug perspective the hello.exe application window open. |
| The C/C++ editor is repositioned in the perspective.</p> |
| <li>In the left margin of the main.cpp window, double-click to set a |
| breakpoint on:<br> |
| cout << "You just entered"</li> |
| <li>Click <b>Run > Resume</b>.</li> |
| <li>When prompted, type a value other than 'm'.<br> |
| The breakpoint will be hit.</li> |
| <li>In the Variable view, verify that the variable is not 'm'.</li> |
| <li>Click <b>Run > Resume</b>.</li> |
| <li>When prompted, type a value other than 'm'.</li> |
| <p>The breakpoint will be hit.</p> |
| <li>In the <b>Variable</b> view, verify that the variable is not 'm'.</li> |
| <li>In the <b>Variable</b> view, right-click the input variable, and select <b>Change |
| Variable Value</b> and type <b>'m'</b>.</li> |
| <li>Click <b>Run > Resume</b>.</li> |
| <p>The output in the hello.exe application window is:<br> |
| "You just entered m, you need to enter m to exit."<li>Type <b>'m'</b> to end the program.<br> |
| The hello.exe application window closes and the debug session ends. The debug |
| perspective remains open.</li> |
| </ol> |
| |
| <p>To learn more about the debug aids at your disposal, refer to the related |
| debug conceptual topics.</p> |
| |
| <p align="left"> <a href="cdt_w_build.htm"> |
| <img border="0" src="../images/ngback.gif" width="16" height="16"></a><b> <a href="cdt_w_build.htm">Back: Building your project</a></b> </p> |
| |
| <p><img border="0" src="../images/ngconcepts.gif" ALT="Related concepts" width="143" height="21"> |
| <br> |
| <a href="../concepts/cdt_c_over_dbg.htm">Debug overview</a><br> |
| <a href="../concepts/cdt_c_dbg_info.htm">Debug information</a></p> |
| <p><img border="0" src="../images/ngtasks.gif" ALT="Related tasks" width="143" height="21"> |
| <br> |
| <a href="../tasks/cdt_o_debug.htm">Debugging</a></p> |
| <p><img border="0" src="../images/ngref.gif" ALT="Related reference" width="143" height="21"> |
| <br> |
| <a href="../reference/cdt_u_dbg_view.htm">Debug view</a><br> |
| <a href="../reference/cdt_u_dbg_view.htm">Debug launch controls</a><br> |
| </p> |
| <p> |
| <img src="../images/ng03_04.gif" ALT="IBM Copyright Statement" BORDER=0 width="324" height="14"> |
| </body> |
| |
| </html> |