locals - 2021.2 English

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

Document ID
UG1400
ft:locale
English (United States)
Release Date
2021-12-15
Version
2021.2 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 variable name and value are not specified, values of all the local variables are returned. Elements of a complex data types like a structure can be accessed through '.' operator. For example, var1.int_type refers to int_type element in 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 [expression] 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 int_type element in var1 struct, where var1 is a member of 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 var1 struct, which is in turn a member of tmp_var struct.