Debugging CalcIt code


CalcIt debugger is a source level debugger for CalcIt code written in UDF/Class and scratchpad/Application editors. The user is able to step through his\her code line by line, insert breakpoints and set watch expressions. The debugger is comprised by a special window where the user has to drop the code he\she wants to debug. The Debugger window has a toolbar, a code area and a watch expressions area.


Code Area

In code area we drop code first to set breakpoints and second to step through its text line by line.

We can insert breakpoints only in lines that start with the plus (+) symbol. To set (or remove) a breakpoint we click the plus (+) symbol.

When the code in the code area is executed then there is a line currently to be executed. This line appears with white text in blue background. Lines with breakpoint appear as white text in red background.

Watch Expressions

A watch expressions is a piece of CalcIt code in which all the variables of the code executed in debug mode are accessible. Every time we press or step to the next line, these expression are reevaluated. So this permits us to watch the values of variables and helps to find errors in code logic. We also can change the value of a variable the same way the code that owns it can. 

Watch expressions are entered in the lower part of the Debugger window. This part is comprised by a two columns list, "Expression" and "Result". When the cursor is in Expression column and we press RETURN, a new line is inserted. In "Expression" column we can enter CalcIt code. This code can process in any way variables of the code in Debug mode. Any result this code returns it appears in the column "Result".

To delete a watch expression line we delete all its text with BACKSPACE. When the line becomes empty and press BACKSPACE the whole line is removed.

NOTE: Automation variables cannot be accessed in watch expressions.

Debugging UDFs

  1. We select a UDF in the list clicking on it. At the right side we press (F11)to bring Debugger Window.
  2. In the Debugger Window we enter or remove breakpoints.
  3. We have to execute in debug mode any Application, Scratchpad code or Calculation/Expresion which somewhere calls the UDF.

Debugging Scratchpad/Application code.

  1. We select the Application or Scratchpad editor we want to debug.
  2. We press (F11) in Scratchpads toolbar. This acts as a kind of drop of the code in the code area of the Debugger window and brings it on top.
  3. We place/remove breakpoints.
  4. We press (F8) in Scratchpad's toolbar to enter execution of the code in debug mode.