Debugging with GDB Manual HP WDB v6.3 (5900-2180, August 2012)
Furthermore, complex data types, such as C structures, are represented in a tree format. For
instance, the struct type variable is the root and the children will represent the struct members.
If a child is itself of a complex type, it will also have children of its own. Appropriate language
differences are handled for C, C++ and Java.
When returning the actual values of the objects, this facility allows for the individual selection of
the display format used in the result creation. It can be chosen among: binary, decimal,
hexadecimal, octal, and natural. Natural refers to a default format automatically chosen based
on the variable type (like decimal for an int, hex for pointers, and so on.).
The following is the complete set of GDB/MI operations defined to access this functionality:
Table 33 GDB/MI Operations
DescriptionOperation
create a variable object-var-create
delete the variable object and its children-var-delete
set the display format of this variable-var-set-format
show the display format of this variable-var-show-format
tells how many children this object has-var-info-num-children
return a list of the object children-var-list-children
show the type of this variable object-var-info-type
print what this variable object represents-var-info-expression
is this variable editable? does it exist here?-var-show-attributes
get the value of this variable-var-evaluate-expression
set the value of this variable-var-assign
update the variable and its children-var-update
In the next subsection we describe each operation in detail and suggest how it can be used.
Description and use of operations on variable objects
The -var-create command
Synopsis
-var-create {name | "-"}
{frame-addr | "*"} expression
This operation creates a variable object, which allows the monitoring of a variable, the result of
an expression, a memory cell or a CPU register.
The name parameter is the string by which the object can be referenced. It must be unique. If '-'
is specified, the varobj system will generate a string “varNNNNNN” automatically. It will be
unique provided that one does not specify name on that format. The command fails if a duplicate
name is found.
The frame under which the expression should be evaluated can be specified by frame-addr. A
'*' indicates that the current frame should be used.
21.14 GDB/MI variable objects 283