Running and debugging
The IDE runs your program inside the compiler, so you can stop it, look at its variables and step through its code without building an executable first.
- Running — Start, Break and End, what Start runs, Run Or Preview (F6), the PROCESS boxes in the status bar, and what ends a run.
- Breakpoints and stepping — breakpoints, the current-line marker, the step commands, Set Next Statement, and the panel that opens when a run-time error stops the program.
- Inspecting a paused program — the VARIABLES, WATCHES and CALL STACK panels, and the value that appears when you point at a variable.
- Debug Console — program output, the input row that runs a line of code, and the trace logger.
- Memory — the raw bytes of the paused program.
The commands of these pages are listed by menu in the Run menu and Debug menu reference pages, and as buttons in the Toolbar.
The three states of a program
A program started from the IDE is in one of three states, and the state decides which commands work.
- Idle. Nothing is running. Start works, and so do the commands that need only a project.
- Running. The program is executing. Break and End work. The step commands do not.
- Paused. The program has stopped at a breakpoint, after a step, at a
Stopstatement, at a run-time error, or because you pressed Break. Start (now continuing), End, the step commands and Set Next Statement work. The editor shows where the program stopped.
The IDE does not make a paused or running program read-only. You can type in the editor in any state. Running says what happens to the program when you do.
At every stop, the IDE shows its own window and asks for the keyboard focus.
The panels that show a paused program
Five panels show the state of a paused program. All of them are in the View menu.
| Panel | Page | In the default layout |
|---|---|---|
| CALL STACK | Call Stack | Yes. Ctrl+L shows it. |
| VARIABLES | Variables | Yes. |
| WATCHES | Watches | No. Add Watch… opens it. |
| DEBUG CONSOLE | Debug Console | Yes. Ctrl+G shows it and moves the focus to its input row. |
| MEMORY 1 | Memory | No. |
Nothing opens a panel when the program stops. If you closed a panel, or your panel layout never had it, open it from the View menu before you run. The panels are empty, or dimmed, while the program is idle or running.
Keys
| Key | Command | Works when |
|---|---|---|
| F5 | Start or continue | A project is open, and the program is idle or paused. |
| Ctrl+Break | Break | The program is running and not paused. |
| F6 | Run Or Preview | A code editor or a form designer is active. |
| F8, F11 | Step Into | The program is paused. |
| Shift+F8, F10 | Step Over | The program is paused. |
| Ctrl+Shift+F8, Shift+F11 | Step Out | The program is paused. |
| Ctrl+F9 | Set Next Statement | The program is paused. |
| F9 | Toggle Breakpoint | The focus is in a code editor. |
| Ctrl+Shift+F9 | Clear All Breakpoints | A project is open. |
| Shift+F9 | Add Watch… | A project is open. |
| Ctrl+L | Show CALL STACK | In any state of the program. |
| Ctrl+G | Show DEBUG CONSOLE | In any state of the program. |
End, Clear Watches and the two Debugger Options items have no key. A key held down repeats, so holding F8 steps over and over. Manage Keyboard Shortcuts changes any of the keys. The Debug Console’s input row has keys of its own, listed in Debug Console.
See Also
- Writing code – the editor, where the breakpoints and the current line show
- Project Settings – Startup Object, Break On All Errors, Debuggable and the trace settings
- Testing with Assert – run a procedure with F6 and read its failures