[Lldb-commits] [PATCH] D13678: [libstdc++ data-formatters] Remove size limits and loop detector.

Siva Chandra via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 12 15:06:18 PDT 2015


sivachandra created this revision.
sivachandra added a reviewer: granata.enrico.
sivachandra added a subscriber: lldb-commits.

http://reviews.llvm.org/D13678

Files:
  examples/synthetic/gnu_libstdcpp.py

Index: examples/synthetic/gnu_libstdcpp.py
===================================================================
--- examples/synthetic/gnu_libstdcpp.py
+++ examples/synthetic/gnu_libstdcpp.py
@@ -15,50 +15,14 @@
 		self.count = None
 		logger >> "Providing synthetic children for a map named " + str(valobj.GetName())
 
-	def next_node(self,node):
-		logger = lldb.formatters.Logger.Logger()
-		return node.GetChildMemberWithName('_M_next')
-
-	def is_valid(self,node):
-		logger = lldb.formatters.Logger.Logger()
-		return self.value(self.next_node(node)) != self.node_address
-
-	def value(self,node):
-		logger = lldb.formatters.Logger.Logger()
-		return node.GetValueAsUnsigned()
-
-	# Floyd's cycle-finding algorithm
-	# try to detect if this list has a loop
-	def has_loop(self):
-		global _list_uses_loop_detector
-		logger = lldb.formatters.Logger.Logger()
-		if _list_uses_loop_detector == False:
-			logger >> "Asked not to use loop detection"
-			return False
-		slow = self.next
-		fast1 = self.next
-		fast2 = self.next
-		while self.is_valid(slow):
-			slow_value = self.value(slow)
-			fast1 = self.next_node(fast2)
-			fast2 = self.next_node(fast1)
-			if self.value(fast1) == slow_value or self.value(fast2) == slow_value:
-				return True
-			slow = self.next_node(slow)
-		return False
-
 	def num_children(self):
-		global _list_capping_size
 		logger = lldb.formatters.Logger.Logger()
 		if self.count == None:
 			self.count = self.num_children_impl()
-			if self.count > _list_capping_size:
-				self.count = _list_capping_size
 		return self.count
 
 	def num_children_impl(self):
 		logger = lldb.formatters.Logger.Logger()
-		global _list_capping_size
 		try:
 			next_val = self.next.GetValueAsUnsigned(0)
 			prev_val = self.prev.GetValueAsUnsigned(0)
@@ -69,15 +33,11 @@
 				return 0
 			if next_val == prev_val:
 				return 1
-			if self.has_loop():
-				return 0
 			size = 2
 			current = self.next
 			while current.GetChildMemberWithName('_M_next').GetValueAsUnsigned(0) != self.node_address:
 				size = size + 1
 				current = current.GetChildMemberWithName('_M_next')
-				if size > _list_capping_size:
-					return _list_capping_size
 			return (size - 1)
 		except:
 			return 0;
@@ -346,12 +306,9 @@
 			pass
 
 	def num_children(self):
-		global _map_capping_size
 		logger = lldb.formatters.Logger.Logger()
 		if self.count == None:
 			self.count = self.num_children_impl()
-			if self.count > _map_capping_size:
-				self.count = _map_capping_size
 		return self.count
 
 	def num_children_impl(self):
@@ -444,7 +401,3 @@
 
 	def has_children(self):
 		return True
-
-_map_capping_size = 255
-_list_capping_size = 255
-_list_uses_loop_detector = True


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13678.37187.patch
Type: text/x-patch
Size: 2695 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151012/6fee1087/attachment.bin>


More information about the lldb-commits mailing list