[Lldb-commits] [PATCH] D114433: [formatters] Draft PR for the list nad forward_list capping_size
walter erquinigo via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Nov 23 08:42:02 PST 2021
wallace requested changes to this revision.
wallace added inline comments.
This revision now requires changes to proceed.
================
Comment at: lldb/examples/synthetic/gnu_libstdcpp.py:14-16
+ if valobj.GetNumChildren() >= list_capping_size:
+ return "(capped) size=" + str(valobj.GetNumChildren())
+ return "size=" + str(valobj.GetNumChildren())
----------------
you have to use > instead of >=
================
Comment at: lldb/examples/synthetic/gnu_libstdcpp.py:31-35
+ try:
+ self.list_capping_size = self.valobj.GetTarget().GetMaximumNumberOfChildrenToDisplay()
+ except:
+ logger >> "Error determining the capping size. The default value 256 is applied"
+ self.list_capping_size = 256
----------------
this shouldn't fail, so remove the try/except
================
Comment at: lldb/examples/synthetic/gnu_libstdcpp.py:61-68
+ # In case of list we know the exact number of children in advance so we do not need to run
+ # cycle detection algorithm
+ if self.has_prev:
+ _list_uses_loop_detector = False
logger = lldb.formatters.Logger.Logger()
if not _list_uses_loop_detector:
logger >> "Asked not to use loop detection"
----------------
these changes shouldn't be here, as has_loop should only be called if the size is not present as a member of the variable. `num_children` is the method that is called by lldb to determine the size of the structure, which invokes `num_children_impl` only if the count is not a member variable. So I have the impression that this code is redundant
================
Comment at: lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/forward_list/TestDataFormatterGenericForwardList.py:66
+ '...'
+ ])
+
----------------
create another test in which you set the setting to 3, for example, and then check the output
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114433/new/
https://reviews.llvm.org/D114433
More information about the lldb-commits
mailing list