Running, Pausing and Stepping
This page covers every command that controls a debug session: starting and pausing the machine, the three step commands and their source-level variants, running to a line, and stepping back. If you have never used the debugger, start with Debug your program, which walks through a first session; this page is the full reference for what that tutorial introduces.

Start, pause, stop and restart
The emulator window and the IDE window each have a toolbar with the same machine controls. Hover a button to see its name and shortcut.
- Start is a split button. The arrow beside it (Choose start mode) switches between running and debugging. In the IDE with a project open the choices are Run Project and Debug Project: they build the project, inject the code into the machine and start it. In the emulator window they are Run Machine and Debug Machine, which start the machine itself. Breakpoints stop the machine only in a debug run.
- Pause stops the machine at the current instruction. The panels of the Debug activity then show its state.
- Continue is a split button too: Continue goes on in normal mode, Continue Debugging in debug mode. It follows the mode the machine was started in.
- Stop switches the machine off. Its memory and state can still be inspected afterwards.
- Restart stops the machine and starts it again. In the IDE with a project open it rebuilds and reruns your program, in the same mode as before.
The same commands are in the menus: Machine › Start, Pause, Stop and Restart, and Debug › Start with Debugging.
Start a debug session
Set a breakpoint (click the margin beside a line), then click Debug Project or press Ctrl+F5. The machine runs until it reaches the breakpoint.
Look around
The highlighted line in the editor is the instruction or statement that runs next. Open the Debug activity for the CPU registers, the call stack, watches and breakpoints.
Step, or continue
Use the step commands below, or press F5 to run on to the next breakpoint.
The step commands
Step Into, Step Over and Step Out are available while the machine is paused, from the toolbar, the Debug menu and the keyboard.
| Command | What it does at the Z80 level |
|---|---|
| Step Into | Runs one instruction. On a CALL or RST, stops at the first instruction of the routine. |
| Step Over | Runs one instruction. A CALL, an RST or a block instruction such as LDIR runs completely, and the machine stops at the instruction after it. |
| Step Out | Runs until the current routine returns to its caller. |
A breakpoint reached during a step ends the step there.
Source statements or Z80 instructions
When the program was built with source-level debug information (Boriel BASIC or C built with z88dk’s sccz80), the IDE toolbar shows two more buttons:
- The step-mode toggle decides what the step buttons step. Its tooltip says which mode is on: Stepping source statements or Stepping Z80 instructions; click it to switch. Source mode is the default.
- Step Over Line (Shift+F10) runs every statement of the current source line and stops at the next line. It works in source mode only.
In source mode the step commands move by statements:
- Step Into stops at the next statement at any depth: the first statement of a called SUB, FUNCTION, GOSUB subroutine or C function, or the next statement here. Code without statements (the runtime, compiler glue, machine code) runs through.
- Step Over stops at the next statement of the current routine; calls run completely.
- Step Out runs until the routine returns and stops at the return point in the caller’s statement, so you see where control came back. In the main program it is disabled.
With Just My Code on (Settings › Debugging, the default), the steps also run through the standard library. Details, and the Call Stack and Variables panels that go with source stepping, are in Call Stack and Variables.
Step Into Target
When the current statement calls more than one routine, the Step Into button gets a drop-down (Step Into Target) listing them in evaluation order, as Step Into name. Choose one to run the others through and stop at the first statement of that routine. The editor’s context menu offers the same items while paused on such a statement.
Run to Cursor
To run to a place without leaving a breakpoint behind:
- In the editor, right-click a line and choose Run to Cursor. It needs a build of the file.
- In the Disassembly view, hold Ctrl (Cmd on macOS) and click the breakpoint gutter of a row, or right-click the row and choose Run to Here.
- In the command prompt, use
run-towith an address.
A paused machine continues in debug mode; a stopped machine starts. The temporary breakpoint is removed as soon as it is reached and is never saved with the project. A machine running in normal mode has to be paused first.
Stepping back
On machines that record an execution history, the toolbar ends with three more buttons: Step Back, Step Forward and Return to the present. Step Back moves one instruction (or statement) into the recorded past; with reverse debugging, on by default, the whole machine goes there. Step Forward moves toward the present, and Return to the present goes straight back to the live machine. The Debug menu adds Reverse Step Over, Reverse Step Out and Reverse Continue; all of them are described in Reverse debugging.
While the debugger stands in the past, the tooltips of Step Into, Step Over, Step Out and Continue end with resumes from the present.
Keyboard shortcuts
| Command | macOS | Windows and Linux |
|---|---|---|
| Start / Continue | F5 | F5 |
| Start with Debugging / Continue Debugging | Ctrl+F5 | Ctrl+F5 |
| Pause | Shift+F5 | Shift+F5 |
| Stop | F4 | F4 |
| Restart | Shift+F4 | Shift+F4 |
| Step Into | F12 | F11 |
| Step Over | F10 | F10 |
| Step Out | Shift+F12 | Shift+F11 |
| Step Over Line | Shift+F10 | Shift+F10 |
| Step Back | Option+F12 | Alt+F11 |
| Step Forward | Option+Shift+F10 | Alt+Shift+F10 |
| Reverse Step Over | Option+F10 | Alt+F10 |
| Reverse Step Out | Option+Shift+F12 | Alt+Shift+F11 |
| Reverse Continue | Option+F5 | Alt+F5 |
On Linux the reverse keys use Ctrl+Alt instead of Alt, because GNOME uses several Alt+function-key combinations itself. Step Into is F12 on macOS because F11 shows the desktop there. The step and reverse keys can be changed: see Keyboard shortcuts.
The commands also have command-prompt forms: em-start, em-debug, em-pause, em-stop,
em-restart, em-sti (Step Into), em-sto (Step Over) and em-out (Step Out). See the
command reference.
Running a NEX file directly
On the ZX Spectrum Next, Run Project and Debug Project build the project and launch the NEX
file the build produces. A .nex file that Klive did not build can be launched on its own, with no
project: right-click it in the Project Explorer and choose
Run NEX file or Debug NEX file, use the buttons of its NEX viewer tab, or run
nex-run. The current machine must be the ZX Spectrum Next. See
Running and inspecting NEX files.