[lldb-dev] Interactive commands in LLDB

Siva Chandra sivachandra at google.com
Thu Feb 26 11:02:02 PST 2015


On Thu, Feb 26, 2015 at 10:55 AM,  <jingham at apple.com> wrote:
>
>> On Feb 26, 2015, at 10:46 AM, Siva Chandra <sivachandra at google.com> wrote:
>>
>> Firstly, thanks for taking time to answer and respond to me.
>>
>> I would like to present some historical context here wrt the "explore"
>> command in GDB. Back when it was added, my use for it was to
>> understand GCC's mega structs and unions. There was something like a
>> flag typically which kind of specified how to interpret (for example,
>> which field of a union is relevant) the rest of struct and union. So,
>> it all made sense back then to have an interactive command in single
>> session which helped me get to the relevant parts of a struct/union
>> value. IMO, such a use case is still relevant. However, I will go with
>> what your final take on this.
>
> Note, in lldb you could do the same job you are describing here quite
> handily by writing a synthetic child provider.  Since the Python data
> formatters can do logic, it would be straight-forward to write one that
> checks field A, and based on that decides which other fields to print.
> The advantage of this is that then any expression that resolves to a
> variable of that type will be printed appropriately without requiring any
> special action on the user's part.

So, this means that one has to write data formatters (or,
pretty-printers in GDB land) for the data structures in question. Can
I take this as "we prefer data formatters over this explore command"?



More information about the lldb-dev mailing list