[Lldb-commits] [lldb] r153750 - in /lldb/trunk/examples/synthetic: gnu_libstdcpp.py libcxx.py

Enrico Granata egranata at apple.com
Fri Mar 30 09:07:08 PDT 2012


Author: enrico
Date: Fri Mar 30 11:07:08 2012
New Revision: 153750

URL: http://llvm.org/viewvc/llvm-project?rev=153750&view=rev
Log:
Added some logging to STL synthetic children providers - this should help us catch problems; more logging might/will be added as needed

Modified:
    lldb/trunk/examples/synthetic/gnu_libstdcpp.py
    lldb/trunk/examples/synthetic/libcxx.py

Modified: lldb/trunk/examples/synthetic/gnu_libstdcpp.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/gnu_libstdcpp.py?rev=153750&r1=153749&r2=153750&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/gnu_libstdcpp.py (original)
+++ lldb/trunk/examples/synthetic/gnu_libstdcpp.py Fri Mar 30 11:07:08 2012
@@ -89,6 +89,7 @@
 
 	def get_child_at_index(self,index):
 		logger = Logger.Logger()
+		logger >> "Fetching child " + str(index)
 		if index < 0:
 			return None;
 		if index >= self.num_children():
@@ -190,6 +191,7 @@
 
 	def get_child_at_index(self,index):
 		logger = Logger.Logger()
+		logger >> "Retrieving child " + str(index)
 		if index < 0:
 			return None;
 		if index >= self.num_children():
@@ -257,14 +259,20 @@
 			
 			map_type = self.valobj.GetType()
 			if map_type.IsReferenceType():
+				logger >> "Dereferencing type"
 				map_type = map_type.GetDereferencedType()
 			
 			map_arg_0 = str(map_type.GetTemplateArgumentType(0).GetName())
 			map_arg_1 = str(map_type.GetTemplateArgumentType(1).GetName())
 			
+			logger >> "map has args " + str(map_arg_0) + " and " + str(map_arg_1)
+			
 			map_arg_0,fixed_0 = self.fixup_class_name(map_arg_0)
 			map_arg_1,fixed_1 = self.fixup_class_name(map_arg_1)
 			
+			logger >> "arg_0 has become: " + str(map_arg_0) + " (fixed: " + str(fixed_0) + ")"
+			logger >> "arg_1 has become: " + str(map_arg_1) + " (fixed: " + str(fixed_1) + ")"
+			
 			# HACK: this is related to the above issue with the typename for std::string
 			# being shortened by clang - the changes to typename display and searching to honor
 			# namespaces make it so that we go looking for std::pair<const std::basic_string<char>, ...>
@@ -281,8 +289,12 @@
 			else:
 				map_arg_type = map_arg_type + ">"
 			
+			logger >> "final contents datatype is: " + str(map_arg_type)
+			
 			self.data_type = self.valobj.GetTarget().FindFirstType(map_arg_type)
 			
+			logger >> "and the SBType is: " + str(self.data_type)
+			
 			# from libstdc++ implementation of _M_root for rbtree
 			self.Mroot = self.Mheader.GetChildMemberWithName('_M_parent')
 			self.data_size = self.data_type.GetByteSize()

Modified: lldb/trunk/examples/synthetic/libcxx.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/libcxx.py?rev=153750&r1=153749&r2=153750&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/libcxx.py (original)
+++ lldb/trunk/examples/synthetic/libcxx.py Fri Mar 30 11:07:08 2012
@@ -97,6 +97,7 @@
 
 	def get_child_at_index(self,index):
 		logger = Logger.Logger()
+		logger >> "Retrieving child " + str(index)
 		if index < 0:
 			return None;
 		if index >= self.num_children():
@@ -272,6 +273,7 @@
 
 	def get_child_at_index(self,index):
 		logger = Logger.Logger()
+		logger >> "Fetching child " + str(index)
 		if index < 0:
 			return None;
 		if index >= self.num_children():
@@ -509,11 +511,13 @@
 
 	def get_child_at_index(self,index):
 		logger = Logger.Logger()
+		logger >> "Retrieving child " + str(index)
 		if index < 0:
 			return None
 		if index >= self.num_children():
 			return None;
 		if self.garbage:
+			logger >> "Returning None since this tree is garbage"
 			return None
 		try:
 			iterator = stdmap_iterator(self.root_node,max_count=self.num_children())
@@ -524,6 +528,7 @@
 			need_to_skip = (index > 0)
 			current = iterator.advance(index)
 			if current == None:
+				logger >> "Tree is garbage - returning None"
 				self.garbage = True
 				return None
 			if self.get_data_type():
@@ -538,13 +543,14 @@
 				else:
 					# FIXME we need to have accessed item 0 before accessing any other item!
 					if self.skip_size == None:
+						logger >> "You asked for item > 0 before asking for item == 0, too bad - I have no clue"
 						return None
 					return current.CreateChildAtOffset('[' + str(index) + ']',self.skip_size,self.data_type)
 			else:
-				print "foo"
+				logger >> "Unable to infer data-type - returning None (should mark tree as garbage here?)"
 				return None
 		except Exception as err:
-			print err
+			logger >> "Hit an exception: " + str(err)
 			return None
 
 # Just an example: the actual summary is produced by a summary string: size=${svar%#}





More information about the lldb-commits mailing list