Debugger operation

The SubScript debugger is a graphical tool that visualizes the execution of a SubScript program. It has been programmed in SubScript itself, thereby showing that multiple SubScript scripts may be run at the same time from Scala code.

A typical snapshot is:

Panels

At the top is the controller panel, with

  • an area for the program description
  • a step button
  • an “auto step” check box
  • a speed slider
  • an Exit button

On the far left there is a panel with check boxes for several kinds of graph messages, that determine whether

  • the debugger breaks on such messages (to step or to autostep)
  • the message is logged in the panels a bit more to the right

On the left there are panels with

  • a depiction of the template trees related to called scripts
  • a log list of handled call graph messages
  • the call graph message currently being handled
  • the queue of call graph messages to be handled
The panel on the right shows the call graph. A node has its name as main label; an index is at the top left; the top right shows an “S” if the node has a recent success. The current message being handled and the current node are depicted in red. On the right of n-ary operator nodes are deferred messages, i.e. messages that will be handled later, grouped in a “continuation” message.
Activating the debugger

There are two options to activate the debugger:

  • When working from an SBT project as described in the README.md document, you can start the debugger with:
    sbt ssDebug

    Make sure you have the SubScript Swing dependency before doing so, because the debugger a part of this library:

    libraryDependencies += "org.subscript-lang" %% "subscript-swing" % "2.0.0"
  • In your program code, pass the debugger as an argument to the subscript.vm._execute method. E.g., instead of:
    _execute(_main(args))

    You may optionally insert as the first parameter to the debugger a description string, that will be displayed at the top left area of the debugger window. E.g.,

    val debugger = new GraphicalDebugger
    _execute(_main(args), debugger)

Operation

Click the Step button to see how execution unfolds. You may “automate” this by checking the “Auto” check box; then the speed slider determines the pace.

Deselecting some check boxes on the left may speed up the debugging.

Debugging the Debugger

As the debugger is a SubScript application itself, you may debug it in a debug session. Just run a little different command:

build/pack/bin/scala subscript.swing.GraphicalDebugger \
           subscript.swing.GraphicalDebugger2 HelloWorld

Leave a Reply