Skip to main content

Debugger

Introduction to the Debugger

The JARU IDE debugger allows you to execute your code step by step, inspect variables, and find errors efficiently.

Breakpoints

Breakpoints stop execution at a specific line.

Adding a Breakpoint

  • Click on the left margin next to the line number
  • Or position the cursor on the line and press F9

A red circle will appear indicating the breakpoint.

Removing a Breakpoint

  • Click on the red circle again
  • Or press F9 on the line

Temporarily Disable

  • Right-click on the breakpoint > "Disable"
  • The circle will become hollow

Start Debugging

  1. Add at least one breakpoint
  2. Press F5 or click "Debug"
  3. Execution will stop at the first breakpoint

Debug Controls

ActionShortcutDescription
ContinueF5Continue to the next breakpoint
Step OverF10Execute current line without entering functions
Step IntoF11Enter the function on the current line
Step OutShift+F11Exit the current function
StopShift+F5Stop debugging
RestartCtrl+Shift+F5Restart debugging

Variables Panel

During debugging, the variables panel shows:

Local Variables

Variables in the current scope:

📁 Locals
├── i: 5
├── name: "John"
└── list: [1, 2, 3]

Global Variables

Variables defined in the global scope.

this

Properties of the current object (inside a class).

Watch Window

The Watch window allows you to observe specific expressions.

Adding an Expression

  1. Open the Watch panel
  2. Click "Add expression"
  3. Type the variable or expression (e.g., person.age, list[0], a + b)

Valid Expressions

  • Simple variables: counter
  • Properties: object.property
  • Indexes: list[0]
  • Expressions: a + b * 2
  • Calls: len(list)

The Watch window updates values in real-time while debugging.

Call Stack

Shows the sequence of functions that led to the current point:

📚 Call Stack
├── calculate() - line 25
├── process() - line 18
└── main() - line 5

Click on any entry to jump to that location.

Debug Console

During debugging you can:

  • View output from print and println
  • Evaluate expressions by typing in the console
  • View error messages

Practical Example

func factorial(n)
if (n <= 1) then // Add breakpoint here
return 1
end
return n * factorial(n - 1)
end

var result = factorial(5)
print(result)
  1. Add a breakpoint on the if line
  2. Press F5 to start
  3. Observe the value of n in the variables panel
  4. Use F5 to continue and see how n changes in each recursive call

Tips

Efficient Debugging
  • Use conditional breakpoints for specific cases
  • The Watch window is ideal for complex expressions
  • Step Over (F10) is faster than Step Into (F11) when you don't need to enter known functions
Performance

Step-by-step debugging is slower than normal execution. Use breakpoints strategically instead of going through all the code line by line.