Debugging in Toy Basic

The Toy Basic IDE includes a simple and practical debugger that helps you pause a program, inspect variables, and execute code step by step.

Setting Breakpoints

Breakpoints let you pause the program at a specific line.

  • Click in the left margin next to the line number
  • Or press F9

A red mark in the margin shows that a breakpoint is set.

Starting Debugging

To start the debugger:

  • Click the Debug button
  • Or press F5

When debugging starts, the program runs until it reaches a breakpoint, is interrupted, or finishes.

The Debug Toolbar

When the debugger is active, a special Debug toolbar is shown.

You can use the following commands while debugging:

  • Continue (F5) - resume execution
  • Step Over (F10) - execute the current line without entering called functions
  • Step Into (F11) - execute the current line and enter a called function
  • Step Out (Shift+F11) - continue until the current function returns

Inspecting Program State

When the program is stopped in the debugger, the Information window on the right shows:

  • The current line
  • The current file
  • The current function
  • Local variables and their values
  • Global variables and their values

This helps you understand exactly what the program is doing at that moment.

Stopping or Interrupting the Program

  • Stop - press Shift+F5 to stop the debugger completely
  • Break - press Pause to interrupt a running program and switch to debug mode

Typical Debugging Workflow

  1. Set one or more breakpoints
  2. Press F5 to start debugging
  3. When execution pauses, inspect the current line, function, and variables
  4. Use Step Over, Step Into, and Step Out to follow the program logic
  5. Use Continue, Break, or Stop as needed

See also: