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

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

Unpublished Commit · Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.


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

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

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.

Reviewers: jingham

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D73053

(cherry picked from commit 0478eadf73c191199cba12c85785cfafb8bfa174)