Moving through the Code

This document covers the following topics:


Stepping Through the Code

You can instruct the debugger to execute the next program step. Different commands are available for this purpose:

Stepping Over Another Object

When you instruct the debugger to step over another object, the next program step is executed and the trace position is shown at the corresponding source code line. If this source code line invokes or includes a further Natural object, the debugger steps over this object; that is, all source code of this object is executed at once. The debugger stops, however, if this object contains watchpoints or breakpoints.

Start of instruction setTo step over another object

  • From the Debug menu, choose Step Over.

    Or:
    Press F10.

    Or:
    When the Debug toolbar is shown, choose the following toolbar button:

    Toolbar button

Stepping Into Another Object

When you instruct the debugger to step into another object, the next program step is executed and the trace position is shown at the corresponding source code line. If this source code line invokes or includes a further Natural object, the debugger steps into this object and the trace position is shown at the first executable line.

Start of instruction setTo step into another object

  • From the Debug menu, choose Step Into.

    Or:
    Press F11.

    Or:
    When the Debug toolbar is shown, choose the following toolbar button:

    Toolbar button

Stepping Out Of Another Object

When you instruct the debugger to step out of another object, the debugger returns to the previous program level. The debugger stops, however, if a watchpoint or breakpoint is found before this previous level is reached.

This command is useful if you debug a subprogram and want to continue with the execution of the rest of the subprogram. The execution continues without interruption and stops after the position in the invoking program from which the subprogram has been invoked.

Start of instruction setTo step out of another object

  • From the Debug menu, choose Step Out.

    Or:
    Press CTRL+F11.

    Or:
    When the Debug toolbar is shown, choose the following toolbar button:

    Toolbar button

Going to the Next Breakpoint or Watchpoint

You can instruct the debugger to execute the object until the next active breakpoint is found or until a watchpoint condition becomes true. In this case, the debugger stops at the watchpoint or breakpoint and the trace position is shown at the corresponding source code line.

Start of instruction setTo go to the next watchpoint or breakpoint

  • From the Debug menu, choose Go.

    Or:
    Press F7.

    Or:
    When the Debug toolbar is shown, choose the following toolbar button:

    Toolbar button

Going to the Next Event

In an event-driven application, you can instruct the debugger to execute the object until the next event is sent to the application. The debugger stops, however, if an active watchpoint or breakpoint occurs before the next event is sent.

Start of instruction setTo go to the next event

  • From the Debug menu, choose Go Until Next Event.

    Note:
    In a non-event driven application, this command has the same effect as the Go command.

    Or:
    Press ALT+F7.

Going to the Cursor Position

You can instruct the debugger to execute the object until the source code line at the current cursor position is reached.

Start of instruction setTo go to the cursor position

  1. Place the cursor in the source code line at which execution is to be paused.

  2. Invoke the context menu in the editor and choose Run to Cursor.

    Or:
    Press CTRL+F10.

Going to the Next Statement

You can instruct the debugger to skip code and to resume execution of the object with the source code line in which you have placed the cursor. The skipped code is not executed.

Warning:
Depending on the code you want to skip, this command may lead to unpredictable results. Use this command with care.

Start of instruction setTo go to the next statement

  1. Place the cursor in the source code line with which you want to resume execution.

  2. Invoke the context menu in the editor and choose Set Next Statement.

    Note:
    This command is only available for the object which is currently processed.