Please enable JavaScript to view this site.

DAQFactory User's Guide

Navigation: 5 Sequences & Scripting

5.23 Sequence debugging

Scroll Prev Top Next More

Integrated Debugger:

The sequence text editor contains an integrated debugger.  The debugger allows you to set breakpoints which will temporarily stop the sequence at a particular point so you can examine the state at that time.  Breakpoints can be set by selecting Debug-Toggle Breakpoint from the main menu when you have the cursor on the desired line.  You can set as many breakpoints as you want and execution of a sequence will stop at that point.  Once stopped, there are several step options to run through the sequence one step at a time:

Step In: executes the current step, and if that step is a sequence function, steps to the first step of that function

Step Out: executes all the steps left in the current sequence function and then stops once control is returned to the calling sequence

Step Over: executes the current step, and if that step is a sequence function, executes entire function without stopping, returning control when that function returns (unless of course you have a breakpoint in that function)

There is also:

Continue: starts the sequence back up from the current position until another breakpoint is reached or the sequence stops.

Stop: stops the sequence without executing any more steps

Restart: starts the sequence over from the top

Display Current Line: this will cause DAQFactory to display the current line about to be executed.  DAQFactory does not automatically do this to allow you to view what is happening on your pages as the sequence is being stepped through.

Clear all breakpoints: this clears all breakpoints on the displayed sequence.

Note: sequences can only be debugged when they are running in their own thread (they were started with a Begin Sequence).  A sequence used in an expression in Page Component, a quick action, an event, or elsewhere in DAQFactory will not break at any breakpoints and cannot be debugged.

Assertions:

A valuable tool of most programming languages is the assertion.  An assertion is a statement that is only evaluated when in debug mode, that if false, throws an error.  This is usually used to test that things that you are assuming in your script are actually true.  DAQFactory has a function called assert() that implements this feature.  In order to enable debug mode and thus enable the assert() function, you need to set system.debugMode to 1.  Set it back to 0 to have all the assert() functions ignored.

Assert(expression, message, [uncatchable = 1]): if system.debugMode is set to 1, this function will evaluate the expression and if it is 0, it will throw an error with the given message string.  If the uncatchable parameter is set to 1 (true, the default), then the sequence will stop even if the assert() is inside a try/catch block.  Set uncatchable to 0 (false) to have the assertion caught by your error handling.