cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
The JSL Debugger – Next Steps
Screen Shot 2022-10-13 at 9.15.13 AM.png
 

For this recipe, we will look at what makes the JSL debugger truly powerful, conditional breakpoints. This feature lets us pause a script when a specific condition is met, such as when a variable reaches a certain value. With it, we can target specific input values, loop iterations, column numbers, etc. We will use the same program as we did for the JSL Debugger – Getting Started recipe. It has been slightly modified to help illustrate the points in this recipe.


Ingredients:
  • JSL Debugger

 

Data Table – CVC9

Difficulty: Easy

Steps:
  1. Open the CVC 9 data table and Build CVC List script. Launch the debugger. Set breakpoints on lines 25, 40, and 46. We will be interested in seeing that input strings are parsed correctly. To reiterate information from the previous recipe:
    1. Blank cells are removed

    2. Cells starting with “[ v.” are ignored.

    3. Commas separate individual words.

    4. A slash (/) gives a list of words to combine one or more words after the tilde (~). For example, tener/llevar ~ barba/bigote/gafas is to expanded to six words: tener barba, llevar barba, tener bigote, llevar bigote, tener gafas, llevar gafas. There may be more than two lists in a cell

    5. There may be both slashes and commas in a cell. The entry: tronco, extremidad ~ superior/inferior, should be expanded to: tronco, extremidad superior, extremidad inferior.

  2. Right click the breakpoint on line 25 and select Edit Breakpoint. In the dialog box select the Condition tab. Check the Condition check box and add the condition Contains(item,”,”). item is a variable we will be watching. The Is True radio button should be selected. Click OK. A plus appears in the breakpoint dot indicating it is a conditional breakpoint.
DonMcCormack_0-1665670358172.png

 

  1. Add item, tildeGroup, and builtCartesian to the list of watched variables.
  2. Click the Run button at the top left of the debugger. When prompted, select Section for the Level column and the next three columns for Data columns. Click the Run button in the dialog.
  3. The debugger should be stopped on line 25. The variable item contains the string “pelo, ojo, nariz”. The conditional breakpoint has skipped all cells where there is no comma.
  4. Click Run twice more. The variable tildeGroup contains {“pelo”}.
  5. Click Run once more. tildeGroup now contains {“ojo”}. It appears that strings with only commas are being parsed correctly.
  6. Next, we should check that cells containing tildes are being parsed correctly. We can do this by editing the current conditional breakpoint. In the lower right of the debugger, select the Breakpoints tab. Select the line containing the conditional breakpoint and click the Edit Breakpoint button at the top of the tab (second from the left). Click on the cell in the Condition column containing the breakpoint condition. Edit it to be Contains(item,”~”). Alternatively, we could have edited the line directly in the breakpoints table.
  7. Unselect the check boxes for the breakpoints on lines 40 and 46. This lets us turn off the breakpoints without deleting them.
DonMcCormack_1-1665670358174.png

 

  1. Click the Run button. The debugger will stop at the breakpoint on line 24 for the next observation where item contains a tilde. (Note: if the debugger stops, but item does not contain a tilde, it may be that the debugger was prematurely stopped prior to running to completion. Click the Run without breakpoints button and retry.)
  2. Next, we will check items with both a tilde and comma. Modify the condition on breakpoint 24 to
    Contains(item,"~") & Contains(item,",")
  1. Click Run. We can now iterate through items with both these characters.

When iterating through a large number of items, it can be difficult to determine where or why an issue arises. While the debugger is typically used to step through a script, it can also be used to help diagnose more serious problems.

 

  1. Run the program without the debugger, this time selecting Section for the Level column and all the remaining columns for Data columns.
  2. After clicking Run, we get an error dialog. The information in the log indicates there is a subscripting problem but doesn’t give much detail other than it involved a column and was likely because of the variable targetRows.
DonMcCormack_2-1665670358175.png

 

  1. Relaunch the program in the debugger and click the Run without breakpoints button.
  2. After dismissing the warning dialog, control is passed back to the debugger. We can now explore various variable values. In particular, we can easily identify the problem column as 10.1. Acciones relacionadas con la Vivienda and that targetRows is empty.

Hints for Success:

  • Use conditional breakpoints to target how and when a breakpoint is used to stop.
  • The debugger can be used to determine variable values at the time of failure when errors are not easily found using the log.