[lldb-dev] Interactive commands in LLDB

jingham at apple.com jingham at apple.com
Thu Feb 26 11:06:32 PST 2015


I'd say it another way.  Instead of spending the time on this explore command, which requires you to re-do the labor every time you want to inspect data of that type, produce a rough equivalent but whose job is to interactively produce a synthetic child provider for a particular data type.  These aren't hard to write, but you have to know Python & the SB API's so there a bit of a barrier to using them.  If there was a way to say: if A is 5, then view these three fields, if 6 view these other three, etc, I think that would be pretty neat.

Jim


> On Feb 26, 2015, at 11:02 AM, Siva Chandra <sivachandra at google.com> wrote:
> 
> 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