[SBValue] Add a method GetNumChildren(uint32_t max)
authorSiva Chandra <sivachandra@google.com>
Wed, 21 Oct 2015 19:28:08 +0000 (19:28 +0000)
committerSiva Chandra <sivachandra@google.com>
Wed, 21 Oct 2015 19:28:08 +0000 (19:28 +0000)
commit9ac7a6c51f8643e8a44af41efca0c8c148315bc5
tree1f324c41d38d5d3bda6279345a245865e17b3506
parentc8a8a5e2aeb82403fd93053bef0124d3e82f186e
[SBValue] Add a method GetNumChildren(uint32_t max)

Summary:
Along with this, support for an optional argument to the "num_children"
method of a Python synthetic child provider has also been added. These have
been added with the following use case in mind:

Synthetic child providers currently have a method "has_children" and
"num_children". While the former is good enough to know if there are
children, it does not give any insight into how many children there are.
Though the latter serves this purpose, calculating the number for children
of a data structure could be an O(N) operation if the data structure has N
children. The new method added in this change provide a middle ground.
One can call GetNumChildren(K) to know if a child exists at an index K
which can be as large as the callers tolerance can be. If the caller wants
to know about children beyond K, it can make an other call with 2K. If the
synthetic child provider maintains state about it counting till K
previosly, then the next call is only an O(K) operation. Infact, all
calls made progressively with steps of K will be O(K) operations.

Reviewers: vharron, clayborg, granata.enrico

Subscribers: labath, lldb-commits

Differential Revision: http://reviews.llvm.org/D13778

llvm-svn: 250930
31 files changed:
lldb/include/lldb/API/SBValue.h
lldb/include/lldb/Core/ValueObject.h
lldb/include/lldb/Core/ValueObjectCast.h
lldb/include/lldb/Core/ValueObjectChild.h
lldb/include/lldb/Core/ValueObjectConstResult.h
lldb/include/lldb/Core/ValueObjectDynamicValue.h
lldb/include/lldb/Core/ValueObjectMemory.h
lldb/include/lldb/Core/ValueObjectRegister.h
lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
lldb/include/lldb/Core/ValueObjectVariable.h
lldb/include/lldb/DataFormatters/TypeSynthetic.h
lldb/include/lldb/Interpreter/ScriptInterpreter.h
lldb/scripts/Python/python-wrapper.swig
lldb/scripts/interface/SBValue.i
lldb/source/API/SBValue.cpp
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Core/ValueObject.cpp
lldb/source/Core/ValueObjectCast.cpp
lldb/source/Core/ValueObjectChild.cpp
lldb/source/Core/ValueObjectConstResult.cpp
lldb/source/Core/ValueObjectDynamicValue.cpp
lldb/source/Core/ValueObjectMemory.cpp
lldb/source/Core/ValueObjectRegister.cpp
lldb/source/Core/ValueObjectSyntheticFilter.cpp
lldb/source/Core/ValueObjectVariable.cpp
lldb/source/DataFormatters/TypeSynthetic.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
lldb/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
lldb/test/functionalities/data-formatter/data-formatter-synthval/main.cpp
lldb/test/functionalities/data-formatter/data-formatter-synthval/myIntSynthProvider.py