Execution Control
When the Studio is in debug mode, your program is either running (executing) or in break mode. All debug windows are available when the Studio is in any of these debug modes and are accessible from the Debug menu. However, most debug functionality, such as viewing the current value of variables, is disabled when the program is running. Most debug windows will not reflect up-to-date information until the program is in break mode.
Starting Debugging
To start debugging your program:
- From the Debug menu, select Run, or press F5. This will automatically compile the program only if changes are detected and start debugging. If no changes are detected, it will start debugging immediately.
- You can also select Run (Without Compile) from the Debug menu to start debugging without first compiling the program, even if changes are detected.
Initially, when the program is started and the Studio goes into debug mode, the program runs (executes) until a breakpoint is encountered or the program is manually paused from the Studio.
Stopping Debugging
To stop debugging your program:
- From the Debug menu, select Stop, or press Shift+F5. When debugging is stopped, the Studio will automatically leave debug mode. This should not be confused with Pause. Stop Debugging ends the debug session and closes the program.
The debug session also ends automatically when the program exits. Closing the program being debugged will also stop debugging, and the Studio will automatically leave debug mode.
Step Functionality
The step functionality is available when the program is in break mode. The program enters break mode when a breakpoint is encountered or the program is manually paused from the Studio.
Step Into
Step Into executes the current line, but if the current line contains a method call, execution will be transferred to the called method. The method call is stepped into, and execution breaks at the first line in the called method.
- From the Debug menu or toolbar, select Step Into, or press F11.
Step Over
Step Over executes the current line, just like Step Into, except if the current line contains a method call, in which case it doesn't break at the first line when the called method is entered. The method call is stepped over, and execution breaks at the next line.
If the current line contains no method call, the Step Into and Step Over functions behave the same. If a breakpoint is encountered before the next line, execution breaks at that location.
- From the Debug menu or toolbar, select Step Over, or press F10.
Step Out
Step Out resumes execution until the current method returns to the calling method. Execution will break at the return point of the calling method.
- From the Debug menu or toolbar, select Step Out, or press F12.
Run To Cursor
Run to Cursor resumes execution until the line where the cursor is located is reached. Typically, this is used within a function or procedure to quickly move program execution to a line further down within the method.
- Move the cursor to the line you wish to run to, from the Debug menu or toolbar, select Run To Cursor, or press Shift+F10.
Set Next Instruction
When the program is paused in the debugger, the program pointer may be moved by selecting a new line in your source and selecting the context menu's Set Next Instruction option. This is an advanced technique, and it is up to you to ensure that it is used sensibly. For example, it only makes sense to move the pointer within the current procedure or function.
Continue
Continue leaves break mode and resumes execution until a breakpoint is encountered or the program is manually paused.
- From the Debug menu or toolbar, select Continue, or press F5.
Pause
Pause lets you manually pause the program and enter break mode without a specific breakpoint. Execution will break immediately, and the program enters break mode. After which, you can step through the program, and the various debug windows are updated.
- From the Debug menu or toolbar, select Pause.
Limited Break Mode
When the program is manually paused by selecting Pause from the Debug menu or toolbar, and if the program cannot be paused for some reason, the program enters limited break mode.
When the program is in limited break mode, the Studio operates just like in break mode. Most debug functionality and windows are enabled, except for the Database Tables Window and some specific expressions in the Watches Window and Variables Window that require program intervention.