Variable display
LLDB was recently modified to allow users to define custom formatting options for the variables display.
Usually, when you type frame variable
or
run some expression
LLDB will
automatically choose the way to display your results on
a per-type basis, as in the following example:
(lldb) frame variable
(uint8_t) x = 'a'
(intptr_t) y = 124752287
However, in certain cases, you may want to associate a
different style to the display for certain datatypes.
To do so, you need to give hints to the debugger as to
how variables should be displayed.
A new type command has been introduced in LLDB
which allows to do just that.
Using it you can change your visualization to look like this:
(lldb) frame variable
(uint8_t) x = chr='a' dec=65 hex=0x41
(intptr_t) y = 0x76f919f
There are several features related to data visualization: formats, summaries, filters, synthetic children.
To reflect this, the type command has four
subcommands:
type format
type summary
type filter
type synthetic
These commands are meant to bind printing options to
types. When variables are printed, LLDB will first check
if custom printing options have been associated to a
variable's type and, if so, use them instead of picking
the default choices.
Each of the commands has four subcommands available:
add
: associates a new printing option to one
or more types
delete
: deletes an existing association
list
: provides a listing of all
associations
clear
: deletes all associations