Developer environment

Explains how to use a “development mode” and use the LUA debugger.

Development mode

While starting to write your LUA scripts it is better to first target a single threaded and single backend engine. This allows you to get the LUA script functionality right. It is also much easier to debug a single threaded Trisul engine calling your LUA scripts.

The special ‘debug0’ context

This is a special context that sets up a nice development environment for you.

  1. single threaded
  2. the debug0 context does not actually save the data at the hub, this frees you from cleanups and resets
  3. use the testbench tools which automatically work with the debug0 context
  4. use the built in LUA debugger and interact with the terminal

Creating the debug0 context

Typically this is created automatically when you run the testbench tools

For example :


trisulctl_probe
> testbench run /home/bigcaps/upload_misc.tcpd 

Debugging

The Trisul framework includes a powerful debugger you can use immediately.

The debugger is installed in /usr/local/lib/trisul-probe/plugins/lua/helpers and is available to all scripts without any special download or installation.

Threading Note
Use the debugger using the testbench tools. It could get messy when you turn it on a regular context as multiple threads can enter the debugger at the same time and you cant tell them apart.

To use the debugger



local dbg = require("debugger")

..

-- then at some point
dbg()



that will drop you into the debugger. You can single step, examine variables, Trisul objects, set breakpoints, etc.

For more check out the documentation for debugger.lua