@@ -930,40 +930,55 @@ be implemented by the Python class):
930
930
931
931
class SyntheticChildrenProvider :
932
932
def __init__ (self , valobj , internal_dict ):
933
- this call should initialize the Python object using valobj as the variable to provide synthetic children for
934
- def num_children(self ):
935
- this call should return the number of children that you want your object to have
933
+ this call should initialize the Python object using valobj as the
934
+ variable to provide synthetic children for
935
+ def num_children(self , max_children):
936
+ this call should return the number of children that you want your
937
+ object to have[1 ]
936
938
def get_child_index(self ,name):
937
- this call should return the index of the synthetic child whose name is given as argument
939
+ this call should return the index of the synthetic child whose name is
940
+ given as argument
938
941
def get_child_at_index(self ,index):
939
- this call should return a new LLDB SBValue object representing the child at the index given as argument
942
+ this call should return a new LLDB SBValue object representing the
943
+ child at the index given as argument
940
944
def update(self ):
941
- this call should be used to update the internal state of this Python object whenever the state of the variables in LLDB changes.[1 ]
945
+ this call should be used to update the internal state of this Python
946
+ object whenever the state of the variables in LLDB changes.[2 ]
942
947
Also, this method is invoked before any other method in the interface.
943
948
def has_children (self ):
944
- this call should return True if this object might have children, and False if this object can be guaranteed not to have children.[2 ]
949
+ this call should return True if this object might have children, and
950
+ False if this object can be guaranteed not to have children.[3 ]
945
951
def get_value (self ):
946
- this call can return an SBValue to be presented as the value of the synthetic value under consideration.[3 ]
952
+ this call can return an SBValue to be presented as the value of the
953
+ synthetic value under consideration.[4 ]
947
954
948
955
As a warning, exceptions that are thrown by python formatters are caught
949
956
silently by LLDB and should be handled appropriately by the formatter itself.
950
957
Being more specific, in case of exceptions, LLDB might assume that the given
951
958
object has no children or it might skip printing some children, as they are
952
959
printed one by one.
953
960
954
- [1] This method is optional. Also, a boolean value must be returned (since lldb
961
+ [1] The `max_children ` argument is optional (since lldb 3.8.0) and indicates the
962
+ maximum number of children that lldb is interested in (at this moment). If the
963
+ computation of the number of children is expensive (for example, requires
964
+ travesing a linked list to determine its size) your implementation may return
965
+ `max_children ` rather than the actual number. If the computation is cheap (e.g., the
966
+ number is stored as a field of the object), then you can always return the true
967
+ number of children (that is, ignore the `max_children ` argument).
968
+
969
+ [2] This method is optional. Also, a boolean value must be returned (since lldb
955
970
3.1.0). If ``False `` is returned, then whenever the process reaches a new stop,
956
971
this method will be invoked again to generate an updated list of the children
957
972
for a given variable. Otherwise, if ``True `` is returned, then the value is
958
973
cached and this method won't be called again, effectively freezing the state of
959
974
the value in subsequent stops. Beware that returning ``True `` incorrectly could
960
975
show misleading information to the user.
961
976
962
- [2 ] This method is optional (since lldb 3.2.0). While implementing it in terms
977
+ [3 ] This method is optional (since lldb 3.2.0). While implementing it in terms
963
978
of num_children is acceptable, implementors are encouraged to look for
964
979
optimized coding alternatives whenever reasonable.
965
980
966
- [3 ] This method is optional (since lldb 3.5.2). The `SBValue ` you return here
981
+ [4 ] This method is optional (since lldb 3.5.2). The `SBValue ` you return here
967
982
will most likely be a numeric type (int, float, ...) as its value bytes will be
968
983
used as-if they were the value of the root `SBValue ` proper. As a shortcut for
969
984
this, you can inherit from lldb.SBSyntheticValueProvider, and just define
0 commit comments