Stepping through a program

When a thread is suspended, the step controls can be used to step through the execution of the program line-by-line. While performing a step operation, if a breakpoint or exception is encountered, execution suspends at the breakpoint or exception, and the step operation ends.

Step Over

Issuing a step over allows all threads to run if the line includes a call. Otherwise, only the selected thread runs. To execute a step over command:

    Select the thread that you want to step in the Debug view. Do one of the following:

    • Click the Step Over button (

      Step Over button) in the Debug view toolbar.

    • Select Run > Step Over from the workbench menu bar.

    The currently-selected line is executed and execution suspends on the next executable line.

If you have set node-by-node stepping on in the debugger preferences, the step over action will step node-by-node rather than line-by-line.

Note: If you step over a for-each statement, a new stack frame will be added because the context changes in a for-each loop.

Step Into

Step into does not resume all threads. Rather, only the thread that is doing the step into is resumed.

To execute a step into command:

    Select the thread that you want to step in the Debug view. Do one of the following:

    • Click the Step Into button (

      Step Into button) in the Debug view toolbar.

    • Select Run > Step Into from the workbench menu bar.

    If the current line is a simple statement, this command executes the statement. If the current line is a function or method call, this command steps into the call and stops on the first line of the called function or method.

Use Step Filters/Step Debug

The main purpose of this action is to step into code that has debug information and step over code that does not have debug information. This command allows all threads to run.

To execute a step debug command:

    Select the thread that you want to step in the Debug view. Click the Use Step Filters/Step Debug button (

    Use Step Filters/Step Debug button) in the Debug view toolbar. Do one of the following:

    • Click the Step Into button (

      Step Into button) in the Debug view toolbar.

    • Select Run > Step Into from the workbench menu bar.

    The currently-selected line or statement executes and suspends at the next line encountered for which debug information is available.

Step Return

Issuing a step return allows all threads to run. To execute a step return command:

    Select the thread that you want to step in the Debug view. Do one of the following:

    • Click the Step Return button (

      Step Return button) in the Debug view toolbar.

    • Select Run > Step Return from the workbench menu bar.

    The current execution point, up to the line immediately following the line that called the function, is executed. Execution stops after exiting the current function. If you issue this command from the main entry point, the program runs to completion.

Note: When inside a for-each loop, a step return will step out two stack frames instead of one.

Run to Line

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.

  1. In the editor, place your cursor on the line to which you want the program to run or in the marker bar directly to the left of the line, and select Run to Line from the pop-up menu.

  2. Program execution is resumed and suspends just before the specified line is to be executed.

 

Related tasks

Setting debug preferences
Using the Debug view
Terminating a debug session
Running XSL transformations during a debug session