| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <html> |
| <head> |
| <meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2007. 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> |
| Stepping through the execution of a Java program |
| </title> |
| <script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js"> </script> |
| </head> |
| <body> |
| <h1> |
| Stepping through the execution of a Java program |
| </h1> |
| <p> |
| When a thread is suspended, the step controls can be used to step through the execution of the program line-by-line. |
| If a breakpoint is encountered while performing a step operation, |
| the execution will suspend at the breakpoint and the step operation is |
| ended. |
| </p> |
| <h2> |
| Step over |
| </h2> |
| <ol> |
| <li> |
| Select a stack frame in the <a href="../reference/views/debug/ref-debug_view.htm"><strong>Debug View</strong></a>. The current line of execution in that stack frame is highlighted in the editor in the <strong>Debug Perspective</strong>. </li> |
| <li> |
| Click the <strong><a href="../reference/views/debug/ref-stepover.htm">Step Over</a></strong> button [ <img src="../images/org.eclipse.debug.ui/elcl16/stepover_co.png" alt="Step Over"> ] in the view toolbar, or press the <em><strong>F6</strong></em> key. The currently-selected line is executed and |
| suspends on the next executable line. </li> |
| </ol> |
| <h2> |
| Step into |
| </h2> |
| <ol> |
| <li> |
| Select a stack frame in the <a href="../reference/views/debug/ref-debug_view.htm"><strong>Debug View</strong></a>. The current line of execution in the selected frame is highlighted in the editor in the <strong>Debug Perspective</strong>. </li> |
| |
| <li> Click the <strong><a href="../reference/views/debug/ref-stepinto.htm">Step |
| Into</a></strong> button [ <img src="../images/org.eclipse.debug.ui/elcl16/stepinto_co.png" alt="Step Into"> |
| ] in the view toolbar, or press the <strong><em>F5</em></strong> key. The |
| next expression on the currently-selected line to be executed is invoked, |
| and execution suspends at the next executable line in the method that is invoked. |
| </li> |
| </ol> |
| |
| <h2> Step into Selection</h2> |
| <ol> |
| <li> Select a stack frame in the <a href="../reference/views/debug/ref-debug_view.htm"><strong>Debug View</strong></a>. The current line of execution in |
| the selected frame is highlighted in the editor in the <strong>Debug Perspective</strong>. </li> |
| <li>In the <a href="../reference/ref-java-editor.htm"><strong>Java Editor</strong></a>, within the current line of execution, place the cursor |
| on the name of a method that you would like to step into.</li> |
| <li> Click the <strong>Step into Selection </strong>action in the Run menu or |
| Java editor context menu, or press the <em><strong>Ctrl-F5</strong></em> key. Execution resumes |
| until the selected method is invoked. </li> |
| </ol> |
| <h2> |
| Step with filters |
| </h2> |
| |
| <ol> |
| <li>Toggle the <strong><a href="../reference/views/debug/ref-usestepfilters.htm">Use Step Filters</a></strong> button [ <img src="../images/org.eclipse.debug.ui/elcl16/stepbystep_co.png" alt="Use Step Filters"> ] in the Debug view toolbar, |
| or use <em><strong>Shift+F5</strong></em>. When the action is toggled on, each of the step |
| actions (over, into, return) will apply the set of step filters which are |
| defined in the |
| <a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.debug.ui.JavaStepFilterPreferencePage)")'> |
| <img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Step Filtering preference page"> |
| <strong>Java > Debug > Step Filtering</strong></a> preference page. When a step action is invoked, |
| stepping will continue until an unfiltered location is reached or a breakpoint |
| is encountered.</li> |
| </ol> |
| <h2> |
| Step Return |
| </h2> |
| <ol> |
| <li> |
| Select a stack frame in the <a href="../reference/views/debug/ref-debug_view.htm"><strong>Debug View</strong></a>. The current line of execution in the selected frame is highlighted in the editor in the <strong>Debug Perspective</strong>. </li> |
| <li> |
| Click the <strong><a href="../reference/views/debug/ref-stepreturn.htm">Step Return</a></strong> button [ <img src="../images/org.eclipse.debug.ui/elcl16/stepreturn_co.png" alt="Step Return"> ] in the view toolbar or press the <em><strong>F7</strong></em> key. Execution resumes until the next return |
| statement in the current method is executed, and execution suspends on the next executable line. </li> |
| </ol> |
| <h2> |
| Run to line |
| </h2> |
| <p> |
| When a thread is suspended, it is possible to resume execution until a specified line is executed. This is a convenient way to suspend execution at a line without setting a |
| breakpoint. |
| </p> |
| <ol> |
| <li> |
| Place your cursor on the line at which you want the program to run. </li> |
| <li> |
| Select the <strong>Run to Line</strong> command [ <img src="../images/org.eclipse.debug.ui/elcl16/runtoline_co.png" alt="Run To Line"> ] from the pop-up menu or use |
| <em><strong>Ctrl+R</strong></em>. Program execution is resumed and suspends just before the specified line is to be executed. </li> |
| </ol> |
| <p>It is possible that the line will never be hit and that the program will not suspend. </p> |
| <p> Breakpoints and exceptions can cause the thread to suspend before reaching the specified |
| line.</p> |
| <p> |
| <img border="0" src="../images/ngrelc.png" alt="Related concepts" ><br> |
| <a href="../concepts/cbrkpnts.htm">Breakpoints</a><br> |
| <a href="../concepts/concepts-5.htm">Java perspectives</a> |
| </p> |
| <p> |
| <img border="0" src="../images/ngrelt.png" alt="Related tasks" ><br> |
| <a href="../tasks/task-add_line_breakpoints.htm">Adding breakpoints</a><br> |
| <a href="../tasks/task-launching_java_program.htm">Launching a Java program</a><br> |
| <a href="../tasks/task-resuming_threads.htm">Resuming the execution of suspended threads</a><br> |
| <a href="../tasks/task-running_and_debugging.htm">Running and debugging</a><br> |
| <a href="../tasks/tasks-executionArgs.htm">Setting execution arguments</a><br> |
| <a href="../tasks/task-suspending_threads.htm">Suspending threads</a><br> |
| </p> |
| <p> |
| <img border="0" src="../images/ngrelr.png" alt="Related reference" ><br> |
| <a href="../reference/views/debug/ref-debug_view.htm">Debug view</a> </p> |
| <p> </p> |
| </body> |
| </html> |
| |