SourcePoint Intel Help

Table of Contents

Debug Variable Arrays

The define command is used to create debug variable and debug variable arrays. Use a bracketed expression suffixed to the debug variable name to create an array. The value of the expression determines the size of the array. The definition type will determine the type of the array elements. See the example below which illustrates how to define an array named ValueArray with 32 elements of type ord4.

Command input

define ord4 ValueArray[0x20]

You can then use a for loop to assign values to this array:

Command input:

define ord1 cnt = 0
define ord4 value = 0x0f
for (cnt=0; cnt < 32t; cnt++)
{
  ValueArray[cnt] = value
  value = value * 0x0f
}

Arrays can also be initialized at the time they are defined, such as:

Command input:

define nstring StrList[10] = "empty"

Notes on Defining Arrays

  • Unless otherwise specified, all array elements are initialized to 0, or the type specific equivalent.

  • Arrays are global or local in scope under the same conditions as non-composite debug-variable types.

  • Attempting to access an array element using an invalid index value results in an error.

  • Arrays can be passed as arguments to procs and also returned as the return value of a proc. If a data type is specified, it should be followed with brackets, but without a specified array size.

Array Elements

Each element of an array is a fully functional debug variable of the specified type. The individual elements of the array behave the same as a regular debug variable in every respect. Array elements are referenced by a bracketed zero-based index. For an array of n elements, the valid indexes are 0..n-1.

Arrays as Variables

Arrays are limited as to how they may be used as entities. Using an array name without an element reference (no bracketed value) refers to the complete array. The only expression operator is the binary assignment operator. There are no unary operators for arrays. The assignment operator is restricted in the following ways:

  • Arrays can only be assigned the value of other arrays.

  • Array-to-array assignment is only valid when the types are identical.

  • If the arrays differ in size, then the destination array is resized to that of the source array.

Array Type with Debug Object Commands

Arrays are also limited as to how they are managed with debug object commands as follows:

  • The show or remove commands operate on complete arrays but attempting to use these commands to manage a single array element results in an error.

  • The show command shows the type and size of the array but not the array element values.

  • The eval command accepts array elements but causes an error if you attempt to evaluate an array as an entity.