Using the LotusScript Debugger
Enabling the debugger
- To enable the debugger, do one of the following:
- Choose Tools - Debug LotusScript
- Click the "Debug LotusScript" icon on the toolbar
The message "LotusScript debugging started" appears on the status line.
Debugging a script
- With the debugger enabled, open the design element containing the script you want to debug. For instance, to debug an action button or event in a view, first start the debugger, then open the view.
Agents are initialized when you request to run them, so to debug an agent, you do not have to open the application before you enable the debugger. Most other code is initialized when you open the design element that contains it.
Database scripts are initialized when you open the database. To debug a database script, you must close all windows to the database, including those in the Domino Designer and Administrator clients.
Note: To close a database you have opened in Designer, the easiest method is to exit Designer. Even if you close all the tabs and collapse the application in the navigator, it remains active. - Perform the action that starts the script, like clicking a button or choosing an action. When you are in Debug mode and the script runs, execution pauses at the first line of the script and the debugger opens.
When you run a script in Debug mode, the script is in one of three states:
- When a script is interrupted at a breakpoint, the debugger has control.
- When a script is continuing, it runs uninterrupted until a breakpoint is reached. If you do not set any breakpoints in a script, it runs as if the debugger were not present.
- When a script is stepping, control passes to the script and then back to the debugger after the step you have selected is complete. There are three stepping options:
- Step Into executes one statement. If the statement calls a subroutine or function, execution stops at the first line of the subroutine or function.
- Step Over executes one statement in the current module. If the statement is a call to a subroutine or function, execution continues until the subroutine or function completes.
- Step Exit executes multiple statements, until the current module exits.
In Step Over and Step Exit, if execution encounters a Stop statement or a breakpoint, or if an untrapped error occurs, execution is interrupted at that point, even if the statement you were stepping to has not yet been reached. An "untrapped" error is one that occurs at a point in the code where there is no "On Error" statement to trap the error.
Disabling the debugger
To disable the debugger, do one of the following:
- Click the Close Debugger button
- Choose Tools - Debug LotusScript again
- Click the "Debug LotusScript" icon on the toolbar again
The message "LotusScript debugging terminated" appears on the status line.
Stopping script execution
To stop script execution while the debugger is open, click Stop. All scripts that are at a breakpoint are stopped as if the ends of the scripts were reached, and the debugger closes.