locals - 2022.1 English

Vitis Unified Software Platform Documentation: Embedded Software Development (UG1400)

Document ID
UG1400
Release Date
2022-04-26
Version
2022.1 English

Get or set the value of a local variable.

Syntax

locals [options] [variable-name [variable-value]]

Get or set the value of a variable specified by <variable-name>. When the variable name and value are not specified, values of all the local variables are returned. Elements of complex data types like structures can be accessed through the '.' operator. For example, the var1.int_type refers to the int_type element in the var1 struct. Array elements can be accessed through their indices. For example, array1[0] refers to the element at index 0 in array1.

Options

Option Description
-defs Return the variable definitions like address, type, size, and RW flags.
-dict Return the result in Tcl dict format, with variable names as dict keys and variable values as dict values. For complex data like structures, names are in the form of parent.child.

Returns

The return value depends on the options used.

<none>: Variable value(s)

-defs: Variable definition(s)

Nothing, when variable value is set. Error string, if variable value cannot be read or set.

Example(s)

locals Int_Loc

Return the value of the local variable Int_Loc.

locals

Return the values of all the local variables in the current stack frame.

locals -defs

Return definitions of all the local variables in the current stack frame.

locals Int_Loc 23

Set the value of the local variable Int_Loc to 23.

locals tmp_var.var1.int_type

Return the value of the int_type element in the var1 struct, where var1 is a member of the tmp_var struct.

locals tmp_var.var1.array1[0]

Return the value of the element at index 0 in array array1. array1 is a member of the var1 struct, which is in turn a member of the tmp_var struct.