Using breakpoints
A breakpoint causes the execution of a session to suspend at the location where the breakpoint is set.
This table shows the breakpoint types you can define in LN Studio:
Line breakpoints | You can set a line breakpoint on an executable line in the source code. During the debugging, the session execution suspends before that line of code is executed. The debugger selects the session that has suspended and displays the stack frames on that session's stack. The line where the breakpoint was set is highlighted in the editor in the Debug perspective. |
Method breakpoints | You can set method breakpoints on the functions displayed in the Outline view. The session execution suspends when the execution reaches a function for which a breakpoint was set. |
Watchpoints | You can use
watchpoints to monitor variables. There are two types of watchpoints:
You can change the watchpoint type through a Properties dialog in the Breakpoints view. You cannot set a watchpoint on array elements. |
You can set line breakpoints and watchpoints in the LN Studio script editor. You can set method breakpoints in the Outline view.
Breakpoints are displayed in the vertical script editor ruler and in the Breakpoints view.
You can enable and disable breakpoints via their context menus in the Breakpoints view.:
- When a breakpoint is enabled, it causes a session to suspend whenever the breakpoint is reached. Enabled breakpoints are indicated with a blue circle. Resolved breakpoints are shown with a check mark overlay.
- When a breakpoint is disabled, it does not cause sessions to suspend. Disabled breakpoints are indicated with a white circle.
Adding line breakpoints
To set a line breakpoint:
- In the script editor, go to the line where you want to set the breakpoint.
- Double-click on the
marker bar directly to the left of the line.
Alternatively, right-click on the marker bar and, on the shortcut menu, select
.
A new breakpoint marker appears on the marker bar. Also, the new breakpoint appears in the Breakpoints view.
Adding method breakpoints
To set a method breakpoint, complete one of these steps:
- In the Outline view, right-click a function and, on the shortcut menu, select .
- In the script editor, double-click the marker bar next to a line that is part of a function header.
- In the script editor, right-click the marker bar next to a line that is part of a function header and, on the shortcut menu, select .
A new method breakpoint marker appears on the marker bar in the script editor. Also, the new breakpoint appears in the Breakpoints view.
Adding watchpoints
You can define watchpoints for local and global variables via the LN Studio script editor.
Adding a modification watchpoint for a local variable
To set a modification watchpoint for a local variable:
- In the script editor, select the variable (or table field) you want to monitor.
- Right-click and, on the shortcut menu, select Breakpoints view. . A modification watchpoint marker appears in the editor's marker bar, and the new watchpoint is displayed in the
Adding a condition watchpoint for a local variable
To set a condition watchpoint for a local variable:
- In the script editor, select the variable (or table field) you want to monitor.
- Right-click and select Breakpoints view. . A modification watchpoint marker appears in the editor's marker bar, and the new watchpoint is displayed in the
- Use the Properties dialog in the Breakpoints view to change the new watchpoint into a condition watchpoint.
- Right-click in the script editor and, on the shortcut menu, click New Condition Watchpoint dialog is started. . The
- Specify the name of the variable (or table field) you want to monitor.
- Select and indicate when the session must suspend.
Adding a watchpoint for an external or global variable
To set a condition or modification watchpoint for an external or global variable that does not occur in the source code you are editing:
- Right-click in the script editor and click New Condition Watchpoint dialog is started. . The
- Specify the name of the variable (or table field) you want to monitor, and indicate when the session must suspend.
When you define a condition or modification watchpoint, a watch expression is added automatically.
Removing breakpoints
You can easily remove breakpoints when you no longer need them.
To remove a line breakpoint or a watchpoint:
- In the script editor, go to the line where the breakpoint is defined.
- Double-click on the breakpoint icon, or right-click the breakpoint icon and, on the shortcut menu, select .
To remove a method breakpoint, complete one of these steps:
- In the Outline view, right-click the involved function and, on the shortcut menu, select .
- In the script editor, go to the line where the breakpoint is defined and double-click on the breakpoint icon, or right-click the breakpoint icon and, on the shortcut menu, select .
You can also remove breakpoints in the Breakpoints view:
- Right-click the breakpoint(s) to be removed and, on the shortcut menu, select .
- To remove all breakpoints in one go, on the shortcut menu of the Breakpoints view, click .
If you find yourself frequently adding and removing a breakpoint in the same place, consider disabling the breakpoint when you do not need it and enabling it when needed again.
See Breakpoints view.
Enabling and disabling breakpoints
You can disable and enable breakpoints as needed. When a breakpoint is disabled, session execution is not suspended by the presence of the breakpoint.
To disable a breakpoint, complete one of these steps:
- Go to the Breakpoints view and clear the breakpoint's check box.
- In the script editor, right-click the breakpoint in the marker bar and, on the shortcut menu, select .
The breakpoint image changes to a white circle.
To enable a breakpoint, complete one of these steps:
- Go to the Breakpoints view and select the breakpoint's check box.
- In the script editor, right-click the breakpoint in the marker bar and, on the shortcut menu, select .
The breakpoint image changes back to a blue circle.