diff options
-rw-r--r-- | lldb/examples/synthetic/gnu_libstdcpp.py | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/lldb/examples/synthetic/gnu_libstdcpp.py b/lldb/examples/synthetic/gnu_libstdcpp.py index 0daa95f36d0..b6bf42235ac 100644 --- a/lldb/examples/synthetic/gnu_libstdcpp.py +++ b/lldb/examples/synthetic/gnu_libstdcpp.py @@ -22,19 +22,17 @@ class StdListSynthProvider: def is_valid(self,node): logger = lldb.formatters.Logger.Logger() valid = self.value(self.next_node(node)) != self.node_address - if valid: - logger >> "%s is valid" % str(self.valobj.GetName()) - else: - logger >> "synthetic value is not valid" - return valid + if valid: + logger >> "%s is valid" % str(self.valobj.GetName()) + else: + logger >> "synthetic value is not valid" + return valid def value(self,node): logger = lldb.formatters.Logger.Logger() - value = node.GetValueAsUnsigned() - logger >> "synthetic value for {}: {}".format( - str(self.valobj.GetName()), - value) - return value + value = node.GetValueAsUnsigned() + logger >> "synthetic value for {}: {}".format(str(self.valobj.GetName()), value) + return value # Floyd's cycle-finding algorithm # try to detect if this list has a loop @@ -59,12 +57,12 @@ class StdListSynthProvider: def num_children(self): logger = lldb.formatters.Logger.Logger() if self.count is None: - # libstdc++ 6.0.21 added dedicated count field. - count_child = self.node.GetChildMemberWithName('_M_data') - if count_child and count_child.IsValid(): - self.count = count_child.GetValueAsUnsigned(0) - if self.count is None: - self.count = self.num_children_impl() + # libstdc++ 6.0.21 added dedicated count field. + count_child = self.node.GetChildMemberWithName('_M_data') + if count_child and count_child.IsValid(): + self.count = count_child.GetValueAsUnsigned(0) + if self.count is None: + self.count = self.num_children_impl() return self.count def num_children_impl(self): |