[Lldb-commits] [PATCH] D30272: Improve data formatter for libstdcpp unique_ptr

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 23 11:46:01 PST 2017

jingham added a comment.

It definitely does not belong in the summary provider.  So far as I can tell the main benefit of the IsPointerLike part of this thing is that you can do:

  (lldb) frame var isPointerLikeThing->field_of_pointee->field_of_field_of_pointee

which the summary wouldn't help with.

I don't understand your argument about it not belonging in the summary provider.  Maybe you can clarify?

It seems to me clear this is something that people who write synthetic child providers would want to be able to specify.  So hard-coding it in the ValueObject with some special logic to turn it on in the CPP language runtime seems the wrong way to go.

You can also imagine wanting to write a synthetic provider that supports a more complex object - with several interesting synthetic-fields that also has a -> operator.  For such an object, you would want:

(lldb) frame var such_an_object

to print all the synthetic fields, but then:

  (lldb) frame var such_an_object->field_of_pointee->field_of_field_pointee

In that case you need to ask somebody which one of the synthetic fields is the "pointer like" one.  That clearly has to be the parent's synthetic child provider, nobody else can know.  Seems to me, the fact that you had to hard-code this to the 0'th synthetic child demonstrates that this was the wrong approach.


More information about the lldb-commits mailing list