DebuggingΒΆ

Guerilla features a Lua debugger in order to let you develop and debug scripts. By default, the debugger and the developer environment is not activated, but a few operations will let you operate Guerilla in debugging/developper mode.

Show/hide the console

You can show and hide the console in View > Show/Hide console of the main Guerilla window.

Setup the console configuration file

You can setup a configuration file so Guerilla console remembers its state from a session to another. Opened files and the position in these files are recorded, as well as preferred directories and breakpoints.

Setup a console configuration file in Preferences > Local Settings > Interface > Console Config File

Guerilla should have write permissions to this file.

Activate the Lua debugger

Activate Preferences > Local Settings > Interface > Enable Lua Debugger. This requires you restart Guerilla in order to take effect.

When the debugger is activated, the console contains:

  • on the left pane: a directory browser
  • on the bottom left pane: a local variable watch
  • on the bottom right pane: a callstack/breakpoint inspector

When the debugger is active, execution will stop when an execution error occurs.

Directory browser

The directory browser contains a list of your preferred directories. Expand an entry to view the content of the directory.

You can add an new directory to the list by double-clicking the '...' item at the end of the list.

You can also specify a file extension filter directly in the name of the directory. Select a root item, press F2, then add a '/*.lua' at the end of the directory to filter lua files only (for instance, /a/path/to/my/script/directory/*.lua)

Local variables

When tracing a script, the content of the local variables is displayed. Nodes, plugs and other data can be inspected there.

Callstack

When tracing a script, the callstack of you program is indicated there. Click an item in the list to jump into a different stack frame.

Note that Lua tail calls or C functions may prevent you from visualising the actual code being executed.

Breakpoints

This pane shows the currently active break points. Double click on an item to jump to the code.

You can delete a breakpoint by selecting an item and press the Delete key.

Using the debugger

Execute a piece of script by selecting the piece of code in the script editor clicking 'Execute > Execute Selection' (or pressing Ctrl+E) in the console menu.

Execute the currently edited file by clicking 'Execute > Execute File' (or pressing Ctrl+Shift+E) in the console menu. Note that this will automatically save the edited file.

Toggle a breakpoint in a script line by placing the cursor on that line and pressing 'F9'. Note that Guerilla can only stop execution when executing an entire file (Ctrl+Shift+E).

The debugger hot keys are:

on Linux:

  • F5: continue execution after a breakpoint
  • F9: toggle breakpoint on the current line
  • F8: execute one line
  • F7: step into function
  • Ctrl+F7: step out of function

on Windows:

  • F5: continue execution after a breakpoint
  • F9: toggle breakpoint on the current line
  • F10: execute one line
  • F11: step into function
  • Shift+F11: step out of function

Warning: enabling a breakpoint slows down Guerilla execution. Make sure you don't keep non needed breakpoints while working.