Debugger Visualizer Expressions

Expressions manipulate the data of the variables quickly. An expression is evaluated again each time the debugger stops at a breakpoint or you step into or over a routine with F7 or F8. Press Expression button on the toolbar to activate the expression. The drop-down list of the edit box holds several frequently used expressions, and the edit box keeps a history, which the Up and Down keys browse. The selected variable is always accessible through its alias x, so you can switch between variables without changing the expression because the name is different.

Working with vectors

When the selected variable is a vector, these are some of the possible expressions:

ExpressionResult
Sum(x)Sum of all elements of x
Min(x)Minimum of all elements of x
Max(x)Maximum of all elements of x
x(0)First element
x(1)Second element
x(1:3)Vector of 3 elements, starting at the second
x(3:)Vector of all elements starting at index 3
length(x)Length of the vector
x1 = [1.0, 2, 3]Initializes a double precision vector with three elements
x2 = [1, x1]Prepends a value to a vector
x3 = [x1, 1]Appends a value to a vector
x4 = [x1, x2, 1.2]Concatenates two or more vectors and appends a value
x/sum(x)Normalizes the vector with its sum
Mean(x)Average
fft(x)Frequency spectrum

The type of a variable cannot be changed once it is defined: delete the variable from the list of local or global variables, or close the visualizer window. The constraint serves performance: it avoids memory allocations, which lets expressions scale linearly when multithreaded.

Working with matrices

When the selected variable is a matrix, these are some of the possible expressions:

ExpressionResult
Sum(x)Sum of all elements of x
Min(x)Minimum of all elements of x
Max(x)Maximum of all elements of x
x(0)First element of the flattened matrix, its rows concatenated
x(1)Second element of the flattened matrix, its rows concatenated
x(0,0)Value of the first row, first column
x(1:, :)Submatrix starting at row 1, with all columns
x(2:5,3:5)Submatrix of the rows 2 to 5 and the columns 3 to 5
x(:, 2)Third column, as a matrix
x(:)Vector of the flattened matrix, its rows concatenated
x1 = [[1,2];[1,3]]Assigns a matrix of double precision values
length(x)Length of the flattened matrix
rows(x)Number of rows
cols(x)Number of columns
x2 = [[1, 1.2]; x1]Prepends a row to a matrix
x3 = [[1; 1.2], x1]Prepends a column to a matrix
x4 = [x1; x2; x3]Concatenates three vectors as the rows of a matrix
x/sum(x)Normalizes the matrix with its sum
Mean(x)Average
a'Transpose
a\bLeast squares linear solver, a^-1*b
a/bLeast squares linear solver, a*b^-1
Eig(x)Eigenvalues

This is not a complete list of the expressions. On the scripting page, the command help lists all available functions.

Working with strings and string lists

Delphi includes a TStrings visualizer, but it limits the size of the string list to 64 KB or 128 KB. The Dew Debugger Visualizer has no such limit and is considerably faster and more responsive: it evaluates strings and string lists of any size in real time. These expressions manipulate strings and string lists:

ExpressionResult
str(0)First character of the string str
str(2:3)Substring from the 3rd to the 4th character
[str, " ", 1]Concatenates a string and appends an integer
[str; str; "test2"]A list of three strings
strList(2:3)Sublist of the strings from the 3rd to the 4th element
strList(1)Second string of the list
[strList; strList]Concatenates two string lists