This is an archive of the discontinued LLVM Phabricator instance.

[lldb/DataFormatters] Fix the `$$deference$$` synthetic child
ClosedPublic

Authored by friss on Jan 20 2020, 8:50 AM.

Details

Summary

The ValueObject code checks for a special $$dereference$$ synthetic
child to allow formatter providers to implement a natural
dereferencing behavior in frame variable for objects like smart
pointers.

This support was broken when used directly throught the Python API and
not trhough frame variable. The reason is that
SBFrame.FindVariable() will return by default the synthetic variable
if it exists, while frame variable will not do this eagerly. The
code in ValueObject::Dereference() accounted for the latter but not
for the former. The fix is trivial. The test change includes
additional covergage for the already-working bahevior as it wasn't
covered by the testsuite before.

This commit also adds a short piece of documentatione explaining that
it is possible (even advisable) to provide this synthetic child
outstide of the range of the normal children.

Diff Detail

Event Timeline

friss created this revision.Jan 20 2020, 8:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 20 2020, 8:50 AM
JDevlieghere added inline comments.
lldb/docs/use/variable.rst
895

You can enable syntax highlighting for this snippet by using .. code-block:: python instead.

friss updated this revision to Diff 239188.Jan 20 2020, 12:07 PM

use python formatting in docs

jingham accepted this revision.Jan 21 2020, 10:12 AM

Except for one typo in the comment (thanks for adding that BTW) looks good.

lldb/docs/use/variable.rst
907

of -> from

This revision is now accepted and ready to land.Jan 21 2020, 10:12 AM
This revision was automatically updated to reflect the committed changes.