OSDN Git Service

[lldb/DataFormatters] Fix the `$$deference$$` synthetic child
authorFred Riss <friss@apple.com>
Mon, 20 Jan 2020 16:39:25 +0000 (08:39 -0800)
committerFred Riss <friss@apple.com>
Tue, 21 Jan 2020 21:35:55 +0000 (13:35 -0800)
commit0478eadf73c191199cba12c85785cfafb8bfa174
tree12c4b5047f9d49d9bc9423814cd43a6940ad11c6
parentfd109308a7b71c009402b16c5e583ee462bfe9bd
[lldb/DataFormatters] Fix the `$$deference$$` synthetic child

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.

Reviewers: jingham

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D73053
lldb/docs/use/variable.rst
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/fooSynthProvider.py
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp
lldb/source/Core/ValueObject.cpp