Debugging with GDB (September 2007)

Chapter 21: The gd b/mi Interface 319
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.
expression is any expression valid on the current language set (must not begin with a
*’), or one of the following:
*addr ’, where addr is the address of a memory cell
*addr-addr a memory address range (TBD)
$regname a CPU register name
Result
This operation returns the name, number of children and the type of the object created.
Type is returned as a string as the ones generated by the GDB CLI:
name="name ",numchild="N",type="type "
The -var-delete Co mm and
Synopsis
-var-delete name
Deletes a previously created variable object and all of its children.
Returns an error if the object name is not found.
The -var-set-format command
Synopsis
-var-set-format name format-spec
Sets the output format for the value of the object name to be format-spec.
The syntax for the format-spec is as follows:
format-spec
7→
{binary | decimal | hexadecimal | octal | natural}