5.4.1 Using the Generator Debugger
In the following we shall describe the features and functions
of the Generator Debugger.
Opening the Generator Debugger for a generator
In order to debug a generator, you must start its execution by
selecting Generator | Debug... from the menu or by pressing the
corresponding toolbar button in Generator Editor. This will first prompt you to
select the graph for which the generator will be executed. After this selection
the Generator Debugger will open with the execution of the current generator
halted at the beginning. You can now proceed with the operations explained
below.
 | The
Generator Debugger will also be opened when a breakpoint is encountered during
the generator
execution. |
Executing generators in the Generator Debugger
To execute the generator in a Generator Debugger, select
Run | Run from the menu or toolbar (or by pressing F9). This will
start the execution from the beginning of the generator and continue until the
end, unless the user explicitly interrupts the execution either by selecting
Run | Break from the menu or toolbar (or by pressing F11). Usually
the generators execute so fast that there is no chance to interrupt them before
the end, so the break is needed mostly for interrupting the execution of a
generator that has logical execution problem like an infinite recursive loop.
The generation execution Progress Dialog also provides a Break button for
interrupting the execution if needed.
 | If
memory is running extremely low during a generation execution, MetaEdit+ will
consider it as a sign of an infinite recursion and will halt the execution by
bringing up the Generator Debugger
window. |
One important feature of the
debugger is to enable the user to control the execution of the generation with
various degrees of detail. The Generator Debugger provides two different
mechanisms for this purpose. Stepping provides the most accurate execution
control of these two as it enables the user to follow the execution command by
command. To step:
| 1) | Select
Debug | Step Into from the menu or toolbar (or press F5) to dive in to the
execution of the next command or command
block. |
| 2) | Select
Debug | Step Over from the menu or toolbar (or press F6) to execute the next
command or command block without following the call
chain. |
| 3) | Select
Debug | Step Out from the menu or toolbar (or press F7) to complete the
execution of the currently inspected command or command
block. |
Another way to control the
execution is to run to the cursor, which executes the generator until the
current cursor position is reached. To do this, select
Debug | Run to
Cursor from the menu or from the toolbar (or press
F8).
Showing the current execution position
The current execution position is highlighted on the
Generator window after each execution step, but if you need to explicitly
re-highlight it (e.g. due to making a text selection, or switching temporarily
to another generator in the generator view), select
Debug | Show Current
Position from the menu or press
F4.
Working with breakpoints
Breakpoints enable the user to define places where the
execution of a generator is interrupted and the Generator Debugger opened for
further observing and investigation. Breakpoints can be added to a generator
definition either in Generator Editor or Debugger. To add a breakpoint in
generator definition:
| 1) | Move
the cursor on wanted breakpoint position in editing
area. |
| 2) | Select
Breakpoint | Add from the menu or from the toolbar. A red dot appears in
selected location to denote the inserted
breakpoint. |
To remove a
breakpoint:
| 1) | Select
the breakpoint you want to remove in the editing
area. |
| 2) | Select
Breakpoint | Remove from the menu or from the
toolbar. |
To remove all breakpoints from
the definition, select Breakpoint | Remove All from the menu.
To customize the behavior of the breakpoints, select one
of the following options from the Breakpoint menu:
 | Enabled:
Breakpoints are enabled in most cases when generator is executed (ie. from
Generator Editor, Editor, Graph or Type Browser, etc.) but not when executed as
part of symbol elements display condition, for text field or for ID
property. |
 | Enabled
While Editing: Breakpoints are active only when generator is executed from
Generator
Editor. |
 | Enabled
While Debugging: Breakpoints are active only when generator is executed from
Generator Editor with Debug
command. |
 | Disabled:
Breakpoints are always ignored. |
To make a
breakpoint conditional, select
Breakpoint | Edit Condition. For more
information about how to set the conditions for breakpoints, please see
‘
Setting breakpoint
condition’ in Section
5.3.1.