Debugging with GDB Manual (5900-1473; WDB 6.2; January 2011)

Table Of Contents
NOTE: In addition to the set of operations described here, we expect the GUI
implementation of a variable window to require, at least, the following operations:
-gdb-show output-radix
-stack-list-arguments
-stack-list-locals
-stack-select-frame
Introduction to variable objects in GDB/MI
The basic idea behind variable objects is the creation of a named object to represent a
variable, an expression, a memory location or even a CPU register. For each object
created, a set of operations is available for examining or changing its properties.
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
21.14 GDB/MI variable objects 355