Page 747 - ExtendSim User Guide
P. 747

Debugging Tools 721
Debugging equations
Setting breakpoints
To step through each line of code, it is first necessary to stop the code execution. In this exam- ple, it requires placing a breakpoint before the “if” statement at the beginning of the equation:
In the dialog of the Equation block, check the Enable Debugger check box Click the Set Breakpoints button
This recompiles the equation in debugging mode and opens two windows:
• The Set Breakpoints window is where you set the breakpoints
• The Breakpoints window lists the breakpoints that have been set. It is used later in this tuto- rial, for “Setting a conditional breakpoint” on page 722.
☞ Code in the Set Breakpoints window cannot be edited.
The gray breakpoint lines in the left mar- gin of the Set Break- points window indicate the only places where break- points can be set.
In the left margin
of the Set Break-
points window,
click the break-
point line that is at the left of the if statement. This turns the gray dash into a red circle.
If you click at the wrong line of code, just click it again to remove the breakpoint. Close the Set Breakpoints window.
Run the simulation. The simulation will run until the breakpoint is reached.
Stepping through the code
When the breakpoint is reached, the Debugger window opens.
• In the Source pane at the bottom of the win- dow, a green arrow is placed at the left of the breakpoint. This indicates that the code before the green arrow has been executed.
☞ The green arrow indicates which line of code will be executed next, once the run is continued.
• TheVariablespaneatthetoprightshowsthe variables used in the equation and the value of each variable at the point before the line of code at the breakpoint is executed.
• Alongthetopofthewindowarefivebuttons. These are used to continue the run, to step
Set Breakpoints window showing breakpoint at “if”
Debugger window showing breakpoint and variable
How To

   745   746   747   748   749