[Lldb-commits] [lldb] r153878 - in /lldb/trunk/examples/summaries/cocoa: CFArray.py CFBag.py CFBinaryHeap.py CFBitVector.py CFDictionary.py CFString.py Class.py NSBundle.py NSDate.py NSException.py NSIndexSet.py NSMachPort.py NSNotification.py NSNumber.py NSSet.py NSURL.py objc_runtime.py

Enrico Granata egranata at apple.com
Mon Apr 2 09:39:29 PDT 2012


Author: enrico
Date: Mon Apr  2 11:39:29 2012
New Revision: 153878

URL: http://llvm.org/viewvc/llvm-project?rev=153878&view=rev
Log:
Logging for data formatters.

Modified:
    lldb/trunk/examples/summaries/cocoa/CFArray.py
    lldb/trunk/examples/summaries/cocoa/CFBag.py
    lldb/trunk/examples/summaries/cocoa/CFBinaryHeap.py
    lldb/trunk/examples/summaries/cocoa/CFBitVector.py
    lldb/trunk/examples/summaries/cocoa/CFDictionary.py
    lldb/trunk/examples/summaries/cocoa/CFString.py
    lldb/trunk/examples/summaries/cocoa/Class.py
    lldb/trunk/examples/summaries/cocoa/NSBundle.py
    lldb/trunk/examples/summaries/cocoa/NSDate.py
    lldb/trunk/examples/summaries/cocoa/NSException.py
    lldb/trunk/examples/summaries/cocoa/NSIndexSet.py
    lldb/trunk/examples/summaries/cocoa/NSMachPort.py
    lldb/trunk/examples/summaries/cocoa/NSNotification.py
    lldb/trunk/examples/summaries/cocoa/NSNumber.py
    lldb/trunk/examples/summaries/cocoa/NSSet.py
    lldb/trunk/examples/summaries/cocoa/NSURL.py
    lldb/trunk/examples/summaries/cocoa/objc_runtime.py

Modified: lldb/trunk/examples/summaries/cocoa/CFArray.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/CFArray.py?rev=153878&r1=153877&r2=153878&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/CFArray.py (original)
+++ lldb/trunk/examples/summaries/cocoa/CFArray.py Mon Apr  2 11:39:29 2012
@@ -10,6 +10,7 @@
 import ctypes
 import objc_runtime
 import metrics
+import Logger
 
 statistics = metrics.Metrics()
 statistics.add_metric('invalid_isa')
@@ -26,13 +27,16 @@
 		pass
 
 	def __init__(self, valobj, dict, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.update()
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def num_children(self):
+		logger = Logger.Logger()
 		stream = lldb.SBStream()
 		self.valobj.GetExpressionPath(stream)
 		num_children_vo = self.valobj.CreateValueFromExpression("count","(int)[" + stream.GetData() + " count]");
@@ -49,6 +53,7 @@
 		pass
 
 	def __init__(self, valobj, dict, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not (self.sys_params.types_cache.ulong):
@@ -56,9 +61,11 @@
 		self.update()
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def num_children(self):
+		logger = Logger.Logger()
 		num_children_vo = self.valobj.CreateChildAtOffset("count",
 							self.sys_params.cfruntime_size,
 							self.sys_params.types_cache.ulong)
@@ -69,6 +76,7 @@
 		pass
 
 	def __init__(self, valobj, dict, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not(self.sys_params.types_cache.long):
@@ -76,10 +84,12 @@
 		self.update()
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	# skip the isa pointer and get at the size
 	def num_children(self):
+		logger = Logger.Logger()
 		count = self.valobj.CreateChildAtOffset("count",
 				self.sys_params.pointer_size,
 				self.sys_params.types_cache.long);
@@ -90,6 +100,7 @@
 		pass
 
 	def __init__(self, valobj, dict, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not(self.sys_params.types_cache.long):
@@ -97,10 +108,12 @@
 		self.update()
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	# skip the isa pointer and get at the size
 	def num_children(self):
+		logger = Logger.Logger()
 		count = self.valobj.CreateChildAtOffset("count",
 				self.sys_params.pointer_size,
 				self.sys_params.types_cache.long);
@@ -114,6 +127,7 @@
 		pass
 
 	def __init__(self, valobj, dict):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.adjust_for_architecture()
 		self.error = False
@@ -121,11 +135,13 @@
 		self.invalid = (self.wrapper == None)
 
 	def num_children(self):
+		logger = Logger.Logger()
 		if self.wrapper == None:
 			return 0;
 		return self.wrapper.num_children()
 
 	def update(self):
+		logger = Logger.Logger()
 		if self.wrapper == None:
 			return
 		self.wrapper.update()
@@ -133,6 +149,7 @@
 	# this code acts as our defense against NULL and unitialized
 	# NSArray pointers, which makes it much longer than it would be otherwise
 	def make_wrapper(self):
+		logger = Logger.Logger()
 		if self.valobj.GetValueAsUnsigned() == 0:
 			self.error = True
 			return objc_runtime.InvalidPointer_Description(True)
@@ -144,6 +161,9 @@
 				return wrapper
 		
 		name_string = class_data.class_name()
+		
+		logger >> "Class name is " + str(name_string)
+		
 		if name_string == '__NSArrayI':
 			wrapper = NSArrayI_SynthProvider(self.valobj, dict, class_data.sys_params)
 			statistics.metric_hit('code_notrun',self.valobj)
@@ -159,6 +179,7 @@
 		return wrapper;
 
 def CFArray_SummaryProvider (valobj,dict):
+	logger = Logger.Logger()
 	provider = NSArray_SynthProvider(valobj,dict);
 	if provider.invalid == False:
 		if provider.error == True:
@@ -167,6 +188,7 @@
 			summary = int(provider.num_children());
 		except:
 			summary = None
+		logger >> "provider gave me " + str(summary)
 		if summary == None:
 			summary = '<variable is not NSArray>'
 		elif isinstance(summary,basestring):

Modified: lldb/trunk/examples/summaries/cocoa/CFBag.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/CFBag.py?rev=153878&r1=153877&r2=153878&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/CFBag.py (original)
+++ lldb/trunk/examples/summaries/cocoa/CFBag.py Mon Apr  2 11:39:29 2012
@@ -10,6 +10,7 @@
 import ctypes
 import objc_runtime
 import metrics
+import Logger
 
 statistics = metrics.Metrics()
 statistics.add_metric('invalid_isa')
@@ -25,6 +26,7 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not(self.sys_params.types_cache.NSUInteger):
@@ -35,18 +37,21 @@
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	# 12 bytes on i386
 	# 20 bytes on x64
 	# most probably 2 pointers and 4 bytes of data
 	def offset(self):
+		logger = Logger.Logger()
 		if self.sys_params.is_64_bit:
 			return 20
 		else:
 			return 12
 
 	def length(self):
+		logger = Logger.Logger()
 		size = self.valobj.CreateChildAtOffset("count",
 							self.offset(),
 							self.sys_params.types_cache.NSUInteger)
@@ -58,14 +63,17 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def length(self):
+		logger = Logger.Logger()
 		stream = lldb.SBStream()
 		self.valobj.GetExpressionPath(stream)
 		num_children_vo = self.valobj.CreateValueFromExpression("count","(int)CFBagGetCount(" + stream.GetData() + " )")
@@ -75,6 +83,7 @@
 
 
 def GetSummary_Impl(valobj):
+	logger = Logger.Logger()
 	global statistics
 	class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
 	if wrapper:
@@ -82,6 +91,9 @@
 	
 	name_string = class_data.class_name()
 	actual_name = name_string
+	
+	logger >> "name string got was " + str(name_string) + " but actual name is " + str(actual_name)
+	
 	if class_data.is_cftype():
 		# CFBag does not expose an actual NSWrapper type, so we have to check that this is
 		# an NSCFType and then check we are a pointer-to __CFBag
@@ -100,6 +112,7 @@
 	return wrapper;
 
 def CFBag_SummaryProvider (valobj,dict):
+	logger = Logger.Logger()
 	provider = GetSummary_Impl(valobj);
 	if provider != None:
 		if isinstance(provider,objc_runtime.SpecialSituation_Description):
@@ -108,6 +121,7 @@
 			summary = provider.length();
 		except:
 			summary = None
+		logger >> "summary got from provider: " + str(summary)
 		# for some reason, one needs to clear some bits for the count
 		# to be correct when using CF(Mutable)BagRef on x64
 		# the bit mask was derived through experimentation

Modified: lldb/trunk/examples/summaries/cocoa/CFBinaryHeap.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/CFBinaryHeap.py?rev=153878&r1=153877&r2=153878&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/CFBinaryHeap.py (original)
+++ lldb/trunk/examples/summaries/cocoa/CFBinaryHeap.py Mon Apr  2 11:39:29 2012
@@ -10,6 +10,7 @@
 import ctypes
 import objc_runtime
 import metrics
+import Logger
 
 statistics = metrics.Metrics()
 statistics.add_metric('invalid_isa')
@@ -25,6 +26,7 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not(self.sys_params.types_cache.NSUInteger):
@@ -35,15 +37,18 @@
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	# 8 bytes on i386
 	# 16 bytes on x64
 	# most probably 2 pointers
 	def offset(self):
+		logger = Logger.Logger()
 		return 2 * self.sys_params.pointer_size
 
 	def length(self):
+		logger = Logger.Logger()
 		size = self.valobj.CreateChildAtOffset("count",
 							self.offset(),
 							self.sys_params.types_cache.NSUInteger)
@@ -55,14 +60,17 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def length(self):
+		logger = Logger.Logger()
 		stream = lldb.SBStream()
 		self.valobj.GetExpressionPath(stream)
 		num_children_vo = self.valobj.CreateValueFromExpression("count","(int)CFBinaryHeapGetCount(" + stream.GetData() + " )");
@@ -72,6 +80,7 @@
 
 
 def GetSummary_Impl(valobj):
+	logger = Logger.Logger()
 	global statistics
 	class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
 	if wrapper:
@@ -79,6 +88,9 @@
 	
 	name_string = class_data.class_name()
 	actual_name = class_data.class_name()
+	
+	logger >> "name string got was " + str(name_string) + " but actual name is " + str(actual_name)
+	
 	if class_data.is_cftype():
 		# CFBinaryHeap does not expose an actual NSWrapper type, so we have to check that this is
 		# an NSCFType and then check we are a pointer-to CFBinaryHeap
@@ -96,6 +108,7 @@
 	return wrapper;
 
 def CFBinaryHeap_SummaryProvider (valobj,dict):
+	logger = Logger.Logger()
 	provider = GetSummary_Impl(valobj);
 	if provider != None:
 		if isinstance(provider,objc_runtime.SpecialSituation_Description):
@@ -104,6 +117,7 @@
 			summary = provider.length();
 		except:
 			summary = None
+		logger >> "summary got from provider: " + str(summary)
 		# for some reason, one needs to clear some bits for the count
 		# to be correct when using CF(Mutable)BagRef on x64
 		# the bit mask was derived through experimentation

Modified: lldb/trunk/examples/summaries/cocoa/CFBitVector.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/CFBitVector.py?rev=153878&r1=153877&r2=153878&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/CFBitVector.py (original)
+++ lldb/trunk/examples/summaries/cocoa/CFBitVector.py Mon Apr  2 11:39:29 2012
@@ -10,20 +10,25 @@
 import ctypes
 import objc_runtime
 import metrics
+import Logger
 
 # first define some utility functions
 def byte_index(abs_pos):
+	logger = Logger.Logger()
 	return abs_pos/8
 
 def bit_index(abs_pos):
+	logger = Logger.Logger()
 	return abs_pos & 7
 
 def get_bit(byte,index):
+	logger = Logger.Logger()
 	if index < 0 or index > 7:
 		return None
 	return (byte >> (7-index)) & 1
 
 def grab_array_item_data(pointer,index):
+	logger = Logger.Logger()
 	return pointer.GetPointeeData(index,1)
 
 statistics = metrics.Metrics()
@@ -37,10 +42,12 @@
 # obey the interface specification for synthetic children providers
 class CFBitVectorKnown_SummaryProvider:
 	def adjust_for_architecture(self):
+		logger = Logger.Logger()
 		self.uiint_size = self.sys_params.types_cache.NSUInteger.GetByteSize()
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not(self.sys_params.types_cache.NSUInteger):
@@ -53,6 +60,7 @@
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	# we skip the CFRuntimeBase
@@ -61,6 +69,7 @@
 	# that wraps the individual bits
 
 	def contents(self):
+		logger = Logger.Logger()
 		count_vo = self.valobj.CreateChildAtOffset("count",self.sys_params.cfruntime_size,
 													self.sys_params.types_cache.NSUInteger)
 		count = count_vo.GetValueAsUnsigned(0)
@@ -100,18 +109,22 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def contents(self):
+		logger = Logger.Logger()
 		return '<unable to summarize this CFBitVector>'
 
 
 def GetSummary_Impl(valobj):
+	logger = Logger.Logger()
 	global statistics
 	class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
 	if wrapper:
@@ -119,6 +132,9 @@
 
 	name_string = class_data.class_name()
 	actual_name = name_string
+	
+	logger >> "name string got was " + str(name_string) + " but actual name is " + str(actual_name)
+	
 	if class_data.is_cftype():
 		# CFBitVectorRef does not expose an actual NSWrapper type, so we have to check that this is
 		# an NSCFType and then check we are a pointer-to CFBitVectorRef
@@ -140,6 +156,7 @@
 	return wrapper;
 
 def CFBitVector_SummaryProvider (valobj,dict):
+	logger = Logger.Logger()
 	provider = GetSummary_Impl(valobj);
 	if provider != None:
 		if isinstance(provider,objc_runtime.SpecialSituation_Description):
@@ -148,6 +165,7 @@
 			summary = provider.contents();
 		except:
 			summary = None
+		logger >> "summary got from provider: " + str(summary)
 		if summary == None or summary == '':
 			summary = '<variable is not CFBitVector>'
 		return summary

Modified: lldb/trunk/examples/summaries/cocoa/CFDictionary.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/CFDictionary.py?rev=153878&r1=153877&r2=153878&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/CFDictionary.py (original)
+++ lldb/trunk/examples/summaries/cocoa/CFDictionary.py Mon Apr  2 11:39:29 2012
@@ -10,6 +10,7 @@
 import ctypes
 import objc_runtime
 import metrics
+import Logger
 
 statistics = metrics.Metrics()
 statistics.add_metric('invalid_isa')
@@ -25,6 +26,7 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not(self.sys_params.types_cache.NSUInteger):
@@ -35,6 +37,7 @@
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	# empirically determined on both 32 and 64bit desktop Mac OS X
@@ -42,12 +45,14 @@
 	# the description of __CFDictionary is not readily available so most
 	# of this is guesswork, plain and simple
 	def offset(self):
+		logger = Logger.Logger()
 		if self.sys_params.is_64_bit:
 			return 20
 		else:
 			return 12
 
 	def num_children(self):
+		logger = Logger.Logger()
 		num_children_vo = self.valobj.CreateChildAtOffset("count",
 							self.offset(),
 							self.sys_params.types_cache.NSUInteger)
@@ -59,6 +64,7 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not(self.sys_params.types_cache.NSUInteger):
@@ -69,13 +75,16 @@
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	# we just need to skip the ISA and the count immediately follows
 	def offset(self):
+		logger = Logger.Logger()
 		return self.sys_params.pointer_size
 
 	def num_children(self):
+		logger = Logger.Logger()
 		num_children_vo = self.valobj.CreateChildAtOffset("count",
 							self.offset(),
 							self.sys_params.types_cache.NSUInteger)
@@ -95,6 +104,7 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not(self.sys_params.types_cache.NSUInteger):
@@ -105,6 +115,7 @@
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	# we just need to skip the ISA and the count immediately follows
@@ -112,6 +123,7 @@
 		return self.sys_params.pointer_size
 
 	def num_children(self):
+		logger = Logger.Logger()
 		num_children_vo = self.valobj.CreateChildAtOffset("count",
 							self.offset(),
 							self.sys_params.types_cache.NSUInteger)
@@ -131,14 +143,17 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def num_children(self):
+		logger = Logger.Logger()
 		stream = lldb.SBStream()
 		self.valobj.GetExpressionPath(stream)
 		num_children_vo = self.valobj.CreateValueFromExpression("count","(int)[" + stream.GetData() + " count]");
@@ -148,12 +163,16 @@
 
 
 def GetSummary_Impl(valobj):
+	logger = Logger.Logger()
 	global statistics
 	class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
 	if wrapper:
 		return wrapper
 	
 	name_string = class_data.class_name()
+	
+	logger >> "class name is: " + str(name_string)
+	
 	if name_string == '__NSCFDictionary':
 		wrapper = NSCFDictionary_SummaryProvider(valobj, class_data.sys_params)
 		statistics.metric_hit('code_notrun',valobj)
@@ -169,6 +188,7 @@
 	return wrapper;
 
 def CFDictionary_SummaryProvider (valobj,dict):
+	logger = Logger.Logger()
 	provider = GetSummary_Impl(valobj);
 	if provider != None:
 		if isinstance(provider,objc_runtime.SpecialSituation_Description):
@@ -177,6 +197,7 @@
 			summary = provider.num_children();
 		except:
 			summary = None
+		logger >> "got summary " + str(summary)
 		if summary == None:
 			return '<variable is not NSDictionary>'
 		if isinstance(summary,basestring):
@@ -185,6 +206,7 @@
 	return 'Summary Unavailable'
 
 def CFDictionary_SummaryProvider2 (valobj,dict):
+	logger = Logger.Logger()
 	provider = GetSummary_Impl(valobj);
 	if provider != None:
 		if isinstance(provider,objc_runtime.SpecialSituation_Description):
@@ -193,6 +215,7 @@
 			summary = provider.num_children();
 		except:
 			summary = None
+		logger >> "got summary " + str(summary)
 		if summary == None:
 			summary = '<variable is not CFDictionary>'
 		if isinstance(summary,basestring):

Modified: lldb/trunk/examples/summaries/cocoa/CFString.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/CFString.py?rev=153878&r1=153877&r2=153878&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/CFString.py (original)
+++ lldb/trunk/examples/summaries/cocoa/CFString.py Mon Apr  2 11:39:29 2012
@@ -9,8 +9,10 @@
 # (and related NSString class)
 import lldb
 import objc_runtime
+import Logger
 
 def CFString_SummaryProvider (valobj,dict):
+	logger = Logger.Logger()
 	provider = CFStringSynthProvider(valobj,dict);
 	if provider.invalid == False:
 		try:
@@ -27,6 +29,7 @@
 	return ''
 
 def CFAttributedString_SummaryProvider (valobj,dict):
+	logger = Logger.Logger()
 	offset = valobj.GetTarget().GetProcess().GetAddressByteSize()
 	pointee = valobj.GetValueAsUnsigned(0)
 	summary = '<variable is not NSAttributedString>'
@@ -51,16 +54,19 @@
 
 class CFStringSynthProvider:
 	def __init__(self,valobj,dict):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.update()
 
 	# children other than "content" are for debugging only and must not be used in production code
 	def num_children(self):
+		logger = Logger.Logger()
 		if self.invalid:
 			return 0;
 		return 6;
 
 	def read_unicode(self, pointer):
+		logger = Logger.Logger()
 		process = self.valobj.GetTarget().GetProcess()
 		error = lldb.SBError()
 		pystr = u''
@@ -88,6 +94,7 @@
 	# handle the special case strings
 	# only use the custom code for the tested LP64 case
 	def handle_special(self):
+		logger = Logger.Logger()
 		if self.is_64_bit == False:
 			# for 32bit targets, use safe ObjC code
 			return self.handle_unicode_string_safe()
@@ -105,6 +112,7 @@
 			"(char*)\"" + self.valobj.GetObjectDescription() + "\"");
 
 	def handle_unicode_string(self):
+		logger = Logger.Logger()
 		# step 1: find offset
 		if self.inline:
 			pointer = self.valobj.GetValueAsUnsigned(0) + self.size_of_cfruntime_base();
@@ -130,12 +138,14 @@
 		return pystr.encode('utf-8')
 
 	def handle_inline_explicit(self):
+		logger = Logger.Logger()
 		offset = 3*self.pointer_size
 		offset = offset + self.valobj.GetValueAsUnsigned(0)
 		return self.valobj.CreateValueFromExpression("content",
 				"(char*)(" + str(offset) + ")")
 
 	def handle_mutable_string(self):
+		logger = Logger.Logger()
 		offset = 2 * self.pointer_size
 		data = self.valobj.CreateChildAtOffset("content",
 			offset, self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar).GetPointerType());
@@ -144,6 +154,7 @@
 		return self.valobj.CreateValueFromExpression("content", "(char*)(" + str(data_value) + ")")
 
 	def handle_UTF8_inline(self):
+		logger = Logger.Logger()
 		offset = self.valobj.GetValueAsUnsigned(0) + self.size_of_cfruntime_base();
 		if self.explicit == False:
 			offset = offset + 1;
@@ -151,11 +162,14 @@
 				offset, self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar)).AddressOf();
 
 	def handle_UTF8_not_inline(self):
+		logger = Logger.Logger()
 		offset = self.size_of_cfruntime_base();
 		return self.valobj.CreateChildAtOffset("content",
 				offset,self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar).GetPointerType());
 
 	def get_child_at_index(self,index):
+		logger = Logger.Logger()
+		logger >> "Querying for child [" + str(index) + "]"
 		if index == 0:
 			return self.valobj.CreateValueFromExpression("mutable",
 				str(int(self.mutable)));
@@ -201,6 +215,8 @@
 				return self.handle_UTF8_not_inline();
 
 	def get_child_index(self,name):
+		logger = Logger.Logger()
+		logger >> "Querying for child ['" + str(name) + "']"
 		if name == "content":
 			return self.num_children() - 1;
 		if name == "mutable":
@@ -219,6 +235,7 @@
 	# to get its size we add up sizeof(pointer)+4
 	# and then add 4 more bytes if we are on a 64bit system
 	def size_of_cfruntime_base(self):
+		logger = Logger.Logger()
 		return self.pointer_size+4+(4 if self.is_64_bit else 0)
 
 	# the info bits are part of the CFRuntimeBase structure
@@ -227,12 +244,14 @@
 	# on big-endian this means going to byte 3, if we are on
 	# little endian (OSX & iOS), this means reading byte 0
 	def offset_of_info_bits(self):
+		logger = Logger.Logger()
 		offset = self.pointer_size
 		if self.is_little == False:
 			offset = offset + 3;
 		return offset;
 
 	def read_info_bits(self):
+		logger = Logger.Logger()
 		cfinfo = self.valobj.CreateChildAtOffset("cfinfo",
 					self.offset_of_info_bits(),
 					self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar));
@@ -248,15 +267,18 @@
 	# calculating internal flag bits of the CFString object
 	# this stuff is defined and discussed in CFString.c
 	def is_mutable(self):
+		logger = Logger.Logger()
 		return (self.info_bits & 1) == 1;
 
 	def is_inline(self):
+		logger = Logger.Logger()
 		return (self.info_bits & 0x60) == 0;
 
 	# this flag's name is ambiguous, it turns out
 	# we must skip a length byte to get at the data
 	# when this flag is False
 	def has_explicit_length(self):
+		logger = Logger.Logger()
 		return (self.info_bits & (1 | 4)) != 4;
 
 	# probably a subclass of NSString. obtained this from [str pathExtension]
@@ -264,14 +286,17 @@
 	# in the long run using the isa value might be safer as a way to identify this
 	# instead of reading the info_bits
 	def is_special_case(self):
+		logger = Logger.Logger()
 		return self.info_bits == 0;
 
 	def is_unicode(self):
+		logger = Logger.Logger()
 		return (self.info_bits & 0x10) == 0x10;
 
 	# preparing ourselves to read into memory
 	# by adjusting architecture-specific info
 	def adjust_for_architecture(self):
+		logger = Logger.Logger()
 		self.pointer_size = self.valobj.GetTarget().GetProcess().GetAddressByteSize()
 		self.is_64_bit = self.pointer_size == 8
 		self.is_little = self.valobj.GetTarget().GetProcess().GetByteOrder() == lldb.eByteOrderLittle
@@ -279,6 +304,7 @@
 	# reading info bits out of the CFString and computing
 	# useful values to get at the real data
 	def compute_flags(self):
+		logger = Logger.Logger()
 		self.info_bits = self.read_info_bits();
 		if self.info_bits == None:
 			return;
@@ -289,5 +315,6 @@
 		self.special = self.is_special_case();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
-		self.compute_flags();
\ No newline at end of file
+		self.compute_flags();

Modified: lldb/trunk/examples/summaries/cocoa/Class.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/Class.py?rev=153878&r1=153877&r2=153878&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/Class.py (original)
+++ lldb/trunk/examples/summaries/cocoa/Class.py Mon Apr  2 11:39:29 2012
@@ -7,8 +7,10 @@
 """
 import lldb
 import objc_runtime
+import Logger
 
 def Class_Summary(valobj,dict):
+	logger = Logger.Logger()
 	runtime = objc_runtime.ObjCRuntime.runtime_from_isa(valobj)
 	if runtime == None or not runtime.is_valid():
 		return '<error: unknown Class>'

Modified: lldb/trunk/examples/summaries/cocoa/NSBundle.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSBundle.py?rev=153878&r1=153877&r2=153878&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSBundle.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSBundle.py Mon Apr  2 11:39:29 2012
@@ -11,6 +11,7 @@
 import objc_runtime
 import metrics
 import NSURL
+import Logger
 
 statistics = metrics.Metrics()
 statistics.add_metric('invalid_isa')
@@ -26,6 +27,7 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not(self.sys_params.types_cache.NSString):
@@ -33,15 +35,18 @@
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	# we need to skip the ISA, plus four other values
 	# that are luckily each a pointer in size
 	# which makes our computation trivial :-)
 	def offset(self):
+		logger = Logger.Logger()
 		return 5 * self.sys_params.pointer_size
 
 	def url_text(self):
+		logger = Logger.Logger()
 		global statistics
 		text = self.valobj.CreateChildAtOffset("text",
 							self.offset(),
@@ -60,14 +65,17 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		self.update()
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def url_text(self):
+		logger = Logger.Logger()
 		stream = lldb.SBStream()
 		self.valobj.GetExpressionPath(stream)
 		expr = "(NSString*)[" + stream.GetData() + " bundlePath]"
@@ -78,12 +86,15 @@
 
 
 def GetSummary_Impl(valobj):
+	logger = Logger.Logger()
 	global statistics
 	class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
 	if wrapper:
 		return wrapper
 	
 	name_string = class_data.class_name()
+	logger >> "class name is: " + str(name_string)
+	
 	if name_string == 'NSBundle':
 		wrapper = NSBundleKnown_SummaryProvider(valobj, class_data.sys_params)
 		# [NSBundle mainBundle] does return an object that is
@@ -96,6 +107,7 @@
 	return wrapper;
 
 def NSBundle_SummaryProvider (valobj,dict):
+	logger = Logger.Logger()
 	provider = GetSummary_Impl(valobj);
 	if provider != None:
 		if isinstance(provider,objc_runtime.SpecialSituation_Description):
@@ -104,6 +116,7 @@
 			summary = provider.url_text();
 		except:
 			summary = None
+		logger >> "got summary " + str(summary)
 		if summary == None or summary == '':
 			summary = '<variable is not NSBundle>'
 		return summary

Modified: lldb/trunk/examples/summaries/cocoa/NSDate.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSDate.py?rev=153878&r1=153877&r2=153878&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSDate.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSDate.py Mon Apr  2 11:39:29 2012
@@ -14,6 +14,7 @@
 import time
 import datetime
 import CFString
+import Logger
 
 statistics = metrics.Metrics()
 statistics.add_metric('invalid_isa')
@@ -28,11 +29,13 @@
 osx_epoch = datetime.date(2001,1,1).timetuple()
 
 def mkgmtime(t):
-    return time.mktime(t)-time.timezone
+	logger = Logger.Logger()
+	return time.mktime(t)-time.timezone
 
 osx_epoch = mkgmtime(osx_epoch)
 
 def osx_to_python_time(osx):
+	logger = Logger.Logger()
 	if python_epoch <= 2001:
 		return osx + osx_epoch
 	else:
@@ -40,10 +43,12 @@
 
 # represent a struct_time as a string in the format used by Xcode
 def xcode_format_time(X):
+	logger = Logger.Logger()
 	return time.strftime('%Y-%m-%d %H:%M:%S %Z',X)
 
 # represent a count-since-epoch as a string in the format used by Xcode
 def xcode_format_count(X):
+	logger = Logger.Logger()
 	return xcode_format_time(time.localtime(X))
 
 # despite the similary to synthetic children providers, these classes are not
@@ -54,6 +59,7 @@
 		pass
 
 	def __init__(self, valobj, info_bits, data, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		self.update();
@@ -62,9 +68,11 @@
 		self.data = ((data << 8) | (info_bits << 4))
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def value(self):
+		logger = Logger.Logger()
 		# the value of the date-time object is wrapped into the pointer value
 		# unfortunately, it is made as a time-delta after Jan 1 2001 midnight GMT
 		# while all Python knows about is the "epoch", which is a platform-dependent
@@ -78,6 +86,7 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not (self.sys_params.types_cache.double):
@@ -85,12 +94,15 @@
 		self.update()
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def offset(self):
+		logger = Logger.Logger()
 		return self.sys_params.pointer_size
 
 	def value(self):
+		logger = Logger.Logger()
 		value = self.valobj.CreateChildAtOffset("value",
 							self.offset(),
 							self.sys_params.types_cache.double)
@@ -102,6 +114,7 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not (self.sys_params.types_cache.double):
@@ -109,12 +122,15 @@
 		self.update()
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def offset(self):
+		logger = Logger.Logger()
 		return 2*self.sys_params.pointer_size
 
 	def value(self):
+		logger = Logger.Logger()
 		value = self.valobj.CreateChildAtOffset("value",
 							self.offset(),
 							self.sys_params.types_cache.double)
@@ -126,6 +142,7 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not (self.sys_params.types_cache.voidptr):
@@ -133,12 +150,15 @@
 		self.update()
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def offset(self):
+		logger = Logger.Logger()
 		return self.sys_params.pointer_size
 
 	def timezone(self):
+		logger = Logger.Logger()
 		tz_string = self.valobj.CreateChildAtOffset("tz_name",
 							self.offset(),
 							self.sys_params.types_cache.voidptr)
@@ -149,13 +169,16 @@
 		pass
 
 	def __init__(self, valobj):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.update()
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def value(self):
+		logger = Logger.Logger()
 		stream = lldb.SBStream()
 		self.valobj.GetExpressionPath(stream)
 		expr = "(NSString*)[" + stream.GetData() + " description]"
@@ -165,12 +188,15 @@
 		return '<variable is not NSDate>'
 
 def GetSummary_Impl(valobj):
+	logger = Logger.Logger()
 	global statistics
 	class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
 	if wrapper:
 		return wrapper
 	
 	name_string = class_data.class_name()
+	logger >> "class name is: " + str(name_string)
+
 	if name_string == 'NSDate' or name_string == '__NSDate' or name_string == '__NSTaggedDate':
 		if class_data.is_tagged():
 			wrapper = NSTaggedDate_SummaryProvider(valobj,class_data.info_bits(),class_data.value(), class_data.sys_params)
@@ -191,6 +217,7 @@
 
 
 def NSDate_SummaryProvider (valobj,dict):
+	logger = Logger.Logger()
 	provider = GetSummary_Impl(valobj);
 	if provider != None:
 		if isinstance(provider,objc_runtime.SpecialSituation_Description):
@@ -205,6 +232,7 @@
 	return 'Summary Unavailable'
 
 def NSTimeZone_SummaryProvider (valobj,dict):
+	logger = Logger.Logger()
 	provider = GetSummary_Impl(valobj);
 	if provider != None:
 		if isinstance(provider,objc_runtime.SpecialSituation_Description):
@@ -213,6 +241,7 @@
 			summary = provider.timezone();
 		except:
 			summary = None
+		logger >> "got summary " + str(summary)
 		if summary == None:
 			summary = '<variable is not NSTimeZone>'
 		return str(summary)
@@ -220,6 +249,7 @@
 
 
 def CFAbsoluteTime_SummaryProvider (valobj,dict):
+	logger = Logger.Logger()
 	try:
 		value_double = struct.unpack('d', struct.pack('Q', valobj.GetValueAsUnsigned(0)))[0]
 		return xcode_format_count(osx_to_python_time(value_double))

Modified: lldb/trunk/examples/summaries/cocoa/NSException.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSException.py?rev=153878&r1=153877&r2=153878&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSException.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSException.py Mon Apr  2 11:39:29 2012
@@ -10,6 +10,7 @@
 import metrics
 import CFString
 import lldb
+import Logger
 
 statistics = metrics.Metrics()
 statistics.add_metric('invalid_isa')
@@ -22,6 +23,7 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not (self.sys_params.types_cache.id):
@@ -29,14 +31,18 @@
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def offset_name(self):
+		logger = Logger.Logger()
 		return self.sys_params.pointer_size
 	def offset_reason(self):
+		logger = Logger.Logger()
 		return 2*self.sys_params.pointer_size
 
 	def description(self):
+		logger = Logger.Logger()
 		name_ptr = self.valobj.CreateChildAtOffset("name",
 							self.offset_name(),
 							self.sys_params.types_cache.id)
@@ -50,14 +56,17 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def description(self):
+		logger = Logger.Logger()
 		stream = lldb.SBStream()
 		self.valobj.GetExpressionPath(stream)
 		name_vo = self.valobj.CreateValueFromExpression("name","(NSString*)[" + stream.GetData() + " name]");
@@ -68,12 +77,15 @@
 
 
 def GetSummary_Impl(valobj):
+	logger = Logger.Logger()
 	global statistics
 	class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
 	if wrapper:
 		return wrapper
 	
 	name_string = class_data.class_name()
+	logger >> "class name is: " + str(name_string)
+
 	if name_string == 'NSException':
 		wrapper = NSKnownException_SummaryProvider(valobj, class_data.sys_params)
 		statistics.metric_hit('code_notrun',valobj)
@@ -83,6 +95,7 @@
 	return wrapper;
 
 def NSException_SummaryProvider (valobj,dict):
+	logger = Logger.Logger()
 	provider = GetSummary_Impl(valobj);
 	if provider != None:
 		if isinstance(provider,objc_runtime.SpecialSituation_Description):
@@ -91,6 +104,7 @@
 			summary = provider.description();
 		except:
 			summary = None
+		logger >> "got summary " + str(summary)
 		if summary == None:
 			summary = '<variable is not NSException>'
 		return str(summary)

Modified: lldb/trunk/examples/summaries/cocoa/NSIndexSet.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSIndexSet.py?rev=153878&r1=153877&r2=153878&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSIndexSet.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSIndexSet.py Mon Apr  2 11:39:29 2012
@@ -10,6 +10,7 @@
 import ctypes
 import objc_runtime
 import metrics
+import Logger
 
 statistics = metrics.Metrics()
 statistics.add_metric('invalid_isa')
@@ -25,6 +26,7 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not(self.sys_params.types_cache.NSUInteger):
@@ -35,6 +37,7 @@
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	# NS(Mutable)IndexSet works in one of two modes: when having a compact block of data (e.g. a Range)
@@ -45,6 +48,7 @@
 	# is set, then we are in mode 1, using that area to store flags, otherwise, the read pointer is the
 	# location to go look for count in mode 2
 	def count(self):
+		logger = Logger.Logger()
 		mode_chooser_vo = self.valobj.CreateChildAtOffset("mode_chooser",
 							2*self.sys_params.pointer_size,
 							self.sys_params.types_cache.NSUInteger)
@@ -74,14 +78,17 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def count(self):
+		logger = Logger.Logger()
 		stream = lldb.SBStream()
 		self.valobj.GetExpressionPath(stream)
 		expr = "(int)[" + stream.GetData() + " count]"
@@ -92,12 +99,15 @@
 
 
 def GetSummary_Impl(valobj):
+	logger = Logger.Logger()
 	global statistics
 	class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
 	if wrapper:
 		return wrapper
 	
 	name_string = class_data.class_name()
+	logger >> "class name is: " + str(name_string)
+
 	if name_string == 'NSIndexSet' or name_string == 'NSMutableIndexSet':
 		wrapper = NSIndexSetClass_SummaryProvider(valobj, class_data.sys_params)
 		statistics.metric_hit('code_notrun',valobj)
@@ -108,6 +118,7 @@
 
 
 def NSIndexSet_SummaryProvider (valobj,dict):
+	logger = Logger.Logger()
 	provider = GetSummary_Impl(valobj);
 	if provider != None:
 		if isinstance(provider,objc_runtime.SpecialSituation_Description):
@@ -116,6 +127,7 @@
 			summary = provider.count();
 		except:
 			summary = None
+		logger >> "got summary " + str(summary)
 		if summary == None:
 			summary = '<variable is not NSIndexSet>'
 		if isinstance(summary, basestring):

Modified: lldb/trunk/examples/summaries/cocoa/NSMachPort.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSMachPort.py?rev=153878&r1=153877&r2=153878&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSMachPort.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSMachPort.py Mon Apr  2 11:39:29 2012
@@ -10,6 +10,7 @@
 import ctypes
 import objc_runtime
 import metrics
+import Logger
 
 statistics = metrics.Metrics()
 statistics.add_metric('invalid_isa')
@@ -25,6 +26,7 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not(self.sys_params.types_cache.NSUInteger):
@@ -35,18 +37,21 @@
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	# one pointer is the ISA
 	# then we have one other internal pointer, plus
 	# 4 bytes worth of flags. hence, these values
 	def offset(self):
+		logger = Logger.Logger()
 		if self.sys_params.is_64_bit:
 			return 20
 		else:
 			return 12
 
 	def port(self):
+		logger = Logger.Logger()
 		vport = self.valobj.CreateChildAtOffset("port",
 							self.offset(),
 							self.sys_params.types_cache.NSUInteger)
@@ -58,14 +63,17 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def port(self):
+		logger = Logger.Logger()
 		stream = lldb.SBStream()
 		self.valobj.GetExpressionPath(stream)
 		num_children_vo = self.valobj.CreateValueFromExpression("port","(int)[" + stream.GetData() + " machPort]")
@@ -75,12 +83,15 @@
 
 
 def GetSummary_Impl(valobj):
+	logger = Logger.Logger()
 	global statistics
 	class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
 	if wrapper:
 		return wrapper
 	
 	name_string = class_data.class_name()
+	logger >> "class name is: " + str(name_string)
+
 	if name_string == 'NSMachPort':
 		wrapper = NSMachPortKnown_SummaryProvider(valobj, class_data.sys_params)
 		statistics.metric_hit('code_notrun',valobj)
@@ -90,6 +101,7 @@
 	return wrapper;
 
 def NSMachPort_SummaryProvider (valobj,dict):
+	logger = Logger.Logger()
 	provider = GetSummary_Impl(valobj);
 	if provider != None:
 		if isinstance(provider,objc_runtime.SpecialSituation_Description):
@@ -98,6 +110,7 @@
 			summary = provider.port();
 		except:
 			summary = None
+		logger >> "got summary " + str(summary)
 		if summary == None:
 			summary = '<variable is not NSMachPort>'
 		if isinstance(summary, basestring):

Modified: lldb/trunk/examples/summaries/cocoa/NSNotification.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSNotification.py?rev=153878&r1=153877&r2=153878&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSNotification.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSNotification.py Mon Apr  2 11:39:29 2012
@@ -10,6 +10,7 @@
 import metrics
 import CFString
 import lldb
+import Logger
 
 statistics = metrics.Metrics()
 statistics.add_metric('invalid_isa')
@@ -22,6 +23,7 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not (self.sys_params.types_cache.id):
@@ -29,13 +31,16 @@
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	# skip the ISA and go to the name pointer
 	def offset(self):
+		logger = Logger.Logger()
 		return self.sys_params.pointer_size
 
 	def name(self):
+		logger = Logger.Logger()
 		string_ptr = self.valobj.CreateChildAtOffset("name",
 							self.offset(),
 							self.sys_params.types_cache.id)
@@ -47,14 +52,17 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		self.update()
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def name(self):
+		logger = Logger.Logger()
 		stream = lldb.SBStream()
 		self.valobj.GetExpressionPath(stream)
 		name_vo = self.valobj.CreateValueFromExpression("name","(NSString*)[" + stream.GetData() + " name]")
@@ -64,12 +72,15 @@
 
 
 def GetSummary_Impl(valobj):
+	logger = Logger.Logger()
 	global statistics
 	class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
 	if wrapper:
 		return wrapper
 	
 	name_string = class_data.class_name()
+	logger >> "class name is: " + str(name_string)
+
 	if name_string == 'NSConcreteNotification':
 		wrapper = NSConcreteNotification_SummaryProvider(valobj, class_data.sys_params)
 		statistics.metric_hit('code_notrun',valobj)
@@ -79,6 +90,7 @@
 	return wrapper;
 
 def NSNotification_SummaryProvider (valobj,dict):
+	logger = Logger.Logger()
 	provider = GetSummary_Impl(valobj);
 	if provider != None:
 		if isinstance(provider,objc_runtime.SpecialSituation_Description):
@@ -87,6 +99,7 @@
 			summary = provider.name();
 		except:
 			summary = None
+		logger >> "got summary " + str(summary)
 		if summary == None:
 			summary = '<variable is not NSNotification>'
 		return str(summary)

Modified: lldb/trunk/examples/summaries/cocoa/NSNumber.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSNumber.py?rev=153878&r1=153877&r2=153878&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSNumber.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSNumber.py Mon Apr  2 11:39:29 2012
@@ -11,6 +11,7 @@
 import objc_runtime
 import metrics
 import struct
+import Logger
 
 statistics = metrics.Metrics()
 statistics.add_metric('invalid_isa')
@@ -26,6 +27,7 @@
 		pass
 
 	def __init__(self, valobj, info_bits, data, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		self.info_bits = info_bits
@@ -33,9 +35,11 @@
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def value(self):
+		logger = Logger.Logger()
 		# in spite of the plenty of types made available by the public NSNumber API
 		# only a bunch of these are actually used in the internal implementation
 		# unfortunately, the original type information appears to be lost
@@ -57,6 +61,7 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not(self.sys_params.types_cache.char):
@@ -82,9 +87,11 @@
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def value(self):
+		logger = Logger.Logger()
 		global statistics
 		# we need to skip the ISA, then the next byte tells us what to read
 		# we then skip one other full pointer worth of data and then fetch the contents
@@ -158,14 +165,17 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def value(self):
+		logger = Logger.Logger()
 		stream = lldb.SBStream()
 		self.valobj.GetExpressionPath(stream)
 		expr = "(NSString*)[" + stream.GetData() + " stringValue]"
@@ -175,12 +185,15 @@
 		return '<variable is not NSNumber>'
 
 def GetSummary_Impl(valobj):
+	logger = Logger.Logger()
 	global statistics
 	class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
 	if wrapper:
 		return wrapper
 	
 	name_string = class_data.class_name()
+	logger >> "class name is: " + str(name_string)
+
 	if name_string == 'NSNumber' or name_string == '__NSCFNumber':
 		if class_data.is_tagged():
 			wrapper = NSTaggedNumber_SummaryProvider(valobj,class_data.info_bits(),class_data.value(), class_data.sys_params)
@@ -196,6 +209,7 @@
 
 
 def NSNumber_SummaryProvider (valobj,dict):
+	logger = Logger.Logger()
 	provider = GetSummary_Impl(valobj);
 	if provider != None:
 		if isinstance(provider,objc_runtime.SpecialSituation_Description):
@@ -204,6 +218,7 @@
 			summary = provider.value();
 		except:
 			summary = None
+		logger >> "got summary " + str(summary)
 		if summary == None:
 			summary = '<variable is not NSNumber>'
 		return str(summary)

Modified: lldb/trunk/examples/summaries/cocoa/NSSet.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSSet.py?rev=153878&r1=153877&r2=153878&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSSet.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSSet.py Mon Apr  2 11:39:29 2012
@@ -11,6 +11,7 @@
 import objc_runtime
 import metrics
 import CFBag
+import Logger
 
 statistics = metrics.Metrics()
 statistics.add_metric('invalid_isa')
@@ -26,6 +27,7 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not(self.sys_params.types_cache.NSUInteger):
@@ -36,18 +38,21 @@
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	# one pointer is the ISA
 	# then we have one other internal pointer, plus
 	# 4 bytes worth of flags. hence, these values
 	def offset(self):
+		logger = Logger.Logger()
 		if self.sys_params.is_64_bit:
 			return 20
 		else:
 			return 12
 
 	def count(self):
+		logger = Logger.Logger()
 		vcount = self.valobj.CreateChildAtOffset("count",
 							self.offset(),
 							self.sys_params.types_cache.NSUInteger)
@@ -59,14 +64,17 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def count(self):
+		logger = Logger.Logger()
 		stream = lldb.SBStream()
 		self.valobj.GetExpressionPath(stream)
 		expr = "(int)[" + stream.GetData() + " count]"
@@ -80,6 +88,7 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not(self.sys_params.types_cache.NSUInteger):
@@ -90,13 +99,16 @@
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	# we just need to skip the ISA and the count immediately follows
 	def offset(self):
+		logger = Logger.Logger()
 		return self.sys_params.pointer_size
 
 	def count(self):
+		logger = Logger.Logger()
 		num_children_vo = self.valobj.CreateChildAtOffset("count",
 							self.offset(),
 							self.sys_params.types_cache.NSUInteger)
@@ -117,6 +129,7 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not(self.sys_params.types_cache.NSUInteger):
@@ -127,13 +140,16 @@
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	# we just need to skip the ISA and the count immediately follows
 	def offset(self):
+		logger = Logger.Logger()
 		return self.sys_params.pointer_size
 
 	def count(self):
+		logger = Logger.Logger()
 		num_children_vo = self.valobj.CreateChildAtOffset("count",
 							self.offset(),
 							self.sys_params.types_cache.NSUInteger)
@@ -145,6 +161,7 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not (self.sys_params.types_cache.voidptr):
@@ -152,13 +169,16 @@
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	# an NSCountedSet is implemented using a CFBag whose pointer just follows the ISA
 	def offset(self):
+		logger = Logger.Logger()
 		return self.sys_params.pointer_size
 
 	def count(self):
+		logger = Logger.Logger()
 		cfbag_vo = self.valobj.CreateChildAtOffset("bag_impl",
 							self.offset(),
 							self.sys_params.types_cache.voidptr)
@@ -166,12 +186,15 @@
 
 
 def GetSummary_Impl(valobj):
+	logger = Logger.Logger()
 	global statistics
 	class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
 	if wrapper:
 		return wrapper
 	
 	name_string = class_data.class_name()
+	logger >> "class name is: " + str(name_string)
+
 	if name_string == '__NSCFSet':
 		wrapper = NSCFSet_SummaryProvider(valobj, class_data.sys_params)
 		statistics.metric_hit('code_notrun',valobj)
@@ -191,6 +214,7 @@
 
 
 def NSSet_SummaryProvider (valobj,dict):
+	logger = Logger.Logger()
 	provider = GetSummary_Impl(valobj);
 	if provider != None:
 		try:
@@ -207,6 +231,7 @@
 	return 'Summary Unavailable'
 
 def NSSet_SummaryProvider2 (valobj,dict):
+	logger = Logger.Logger()
 	provider = GetSummary_Impl(valobj);
 	if provider != None:
 		if isinstance(provider,objc_runtime.SpecialSituation_Description):
@@ -215,6 +240,7 @@
 			summary = provider.count();
 		except:
 			summary = None
+		logger >> "got summary " + str(summary)
 		# for some reason, one needs to clear some bits for the count returned
 		# to be correct when using directly CF*SetRef as compared to NS*Set
 		# this only happens on 64bit, and the bit mask was derived through

Modified: lldb/trunk/examples/summaries/cocoa/NSURL.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSURL.py?rev=153878&r1=153877&r2=153878&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSURL.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSURL.py Mon Apr  2 11:39:29 2012
@@ -11,6 +11,7 @@
 import objc_runtime
 import metrics
 import CFString
+import Logger
 
 statistics = metrics.Metrics()
 statistics.add_metric('invalid_isa')
@@ -26,6 +27,7 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		if not(self.sys_params.types_cache.NSString):
@@ -35,6 +37,7 @@
 		self.update();
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	# one pointer is the ISA
@@ -42,11 +45,14 @@
 	# (which are also present on a 32-bit system)
 	# plus another pointer, and then the real data
 	def offset_text(self):
+		logger = Logger.Logger()
 		return 24 if self.sys_params.is_64_bit else 16
 	def offset_base(self):
+		logger = Logger.Logger()
 		return self.offset_text()+self.sys_params.pointer_size
 
 	def url_text(self):
+		logger = Logger.Logger()
 		text = self.valobj.CreateChildAtOffset("text",
 							self.offset_text(),
 							self.sys_params.types_cache.NSString)
@@ -71,14 +77,17 @@
 		pass
 
 	def __init__(self, valobj, params):
+		logger = Logger.Logger()
 		self.valobj = valobj;
 		self.sys_params = params
 		self.update()
 
 	def update(self):
+		logger = Logger.Logger()
 		self.adjust_for_architecture();
 
 	def url_text(self):
+		logger = Logger.Logger()
 		stream = lldb.SBStream()
 		self.valobj.GetExpressionPath(stream)
 		url_text_vo = self.valobj.CreateValueFromExpression("url","(NSString*)[" + stream.GetData() + " description]")
@@ -88,12 +97,15 @@
 
 
 def GetSummary_Impl(valobj):
+	logger = Logger.Logger()
 	global statistics
 	class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
 	if wrapper:
 		return wrapper
 	
 	name_string = class_data.class_name()
+	logger >> "class name is: " + str(name_string)
+
 	if name_string == 'NSURL':
 		wrapper = NSURLKnown_SummaryProvider(valobj, class_data.sys_params)
 		statistics.metric_hit('code_notrun',valobj)
@@ -103,6 +115,7 @@
 	return wrapper;
 
 def NSURL_SummaryProvider (valobj,dict):
+	logger = Logger.Logger()
 	provider = GetSummary_Impl(valobj);
 	if provider != None:
 		if isinstance(provider,objc_runtime.SpecialSituation_Description):
@@ -111,6 +124,7 @@
 			summary = provider.url_text();
 		except:
 			summary = None
+		logger >> "got summary " + str(summary)
 		if summary == None or summary == '':
 			summary = '<variable is not NSURL>'
 		return summary

Modified: lldb/trunk/examples/summaries/cocoa/objc_runtime.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/objc_runtime.py?rev=153878&r1=153877&r2=153878&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/objc_runtime.py (original)
+++ lldb/trunk/examples/summaries/cocoa/objc_runtime.py Mon Apr  2 11:39:29 2012
@@ -9,10 +9,12 @@
 import cache
 import attrib_fromdict
 import functools
+import Logger
 
 class Utilities:
 	@staticmethod
 	def read_ascii(process, pointer,max_len=128):
+		logger = Logger.Logger()
 		error = lldb.SBError()
 		content = None
 		try:
@@ -25,6 +27,7 @@
 
 	@staticmethod
 	def is_valid_pointer(pointer, pointer_size, allow_tagged=False, allow_NULL=False):
+		logger = Logger.Logger()
 		if pointer == None:
 			return False
 		if pointer == 0:
@@ -37,12 +40,14 @@
 	# so if any pointer has bits 47 thru 63 high we know that this is not a valid isa
 	@staticmethod
 	def is_allowed_pointer(pointer):
+		logger = Logger.Logger()
 		if pointer == None:
 			return False
 		return ((pointer & 0xFFFF800000000000) == 0)
 
 	@staticmethod
 	def read_child_of(valobj,offset,type):
+		logger = Logger.Logger()
 		child = valobj.CreateChildAtOffset("childUNK",offset,type)
 		if child == None or child.IsValid() == False:
 			return None;
@@ -50,6 +55,7 @@
 
 	@staticmethod
 	def is_valid_identifier(name):
+		logger = Logger.Logger()
 		if name is None:
 			return None
 		if len(name) == 0:
@@ -64,6 +70,7 @@
 
 	@staticmethod
 	def check_is_osx_lion(target):
+		logger = Logger.Logger()
 		# assume the only thing that has a Foundation.framework is a Mac
 		# assume anything < Lion does not even exist
 		mod = target.module['Foundation']
@@ -79,6 +86,7 @@
 	# returns a class_data and a wrapper (or None, if the runtime alone can't decide on a wrapper)
 	@staticmethod
 	def prepare_class_detection(valobj,statistics):
+		logger = Logger.Logger()
 		class_data = ObjCRuntime(valobj)
 		if class_data.is_valid() == False:
 			statistics.metric_hit('invalid_pointer',valobj)
@@ -100,6 +108,7 @@
 
 class RoT_Data:
 	def __init__(self,rot_pointer,params):
+		logger = Logger.Logger()
 		if (Utilities.is_valid_pointer(rot_pointer.GetValueAsUnsigned(),params.pointer_size, allow_tagged=False)):
 			self.sys_params = params
 			self.valobj = rot_pointer
@@ -111,10 +120,12 @@
 			self.namePointer = Utilities.read_child_of(self.valobj,offset,self.sys_params.types_cache.addr_ptr_type)
 			self.check_valid()
 		else:
+			logger >> "Marking as invalid - rot is invalid"
 			self.valid = False
 		if self.valid:
 			self.name = Utilities.read_ascii(self.valobj.GetTarget().GetProcess(),self.namePointer)
 			if not(Utilities.is_valid_identifier(self.name)):
+				logger >> "Marking as invalid - name is invalid"
 				self.valid = False
 
 	# perform sanity checks on the contents of this class_ro_t
@@ -126,6 +137,7 @@
 		#	pass
 
 	def __str__(self):
+		logger = Logger.Logger()
 		return \
 		 "instanceSize = " + hex(self.instance_size()) + "\n" + \
 		 "namePointer = " + hex(self.namePointer) + " --> " + self.name
@@ -134,6 +146,7 @@
 		return self.valid
 
 	def instance_size(self,align=False):
+		logger = Logger.Logger()
 		if self.is_valid() == False:
 			return None
 		if self.instanceSize == None:
@@ -149,6 +162,7 @@
 
 class RwT_Data:
 	def __init__(self,rwt_pointer,params):
+		logger = Logger.Logger()
 		if (Utilities.is_valid_pointer(rwt_pointer.GetValueAsUnsigned(),params.pointer_size, allow_tagged=False)):
 			self.sys_params = params
 			self.valobj = rwt_pointer
@@ -157,6 +171,7 @@
 			self.roPointer = Utilities.read_child_of(self.valobj,8,self.sys_params.types_cache.addr_ptr_type)
 			self.check_valid()
 		else:
+			logger >> "Marking as invalid - rwt is invald"
 			self.valid = False
 		if self.valid:
 			self.rot = self.valobj.CreateValueFromAddress("rot",self.roPointer,self.sys_params.types_cache.addr_ptr_type).AddressOf()
@@ -164,26 +179,32 @@
 
 	# perform sanity checks on the contents of this class_rw_t
 	def check_valid(self):
+		logger = Logger.Logger()
 		self.valid = True
 		if not(Utilities.is_valid_pointer(self.roPointer,self.sys_params.pointer_size,allow_tagged=False)):
+			logger >> "Marking as invalid - ropointer is invalid"
 			self.valid = False
 
 	def __str__(self):
+		logger = Logger.Logger()
 		return \
 		 "roPointer = " + hex(self.roPointer)
 
 	def is_valid(self):
+		logger = Logger.Logger()
 		if self.valid:
 			return self.data.is_valid()
 		return False
 
 class Class_Data_V2:
 	def __init__(self,isa_pointer,params):
+		logger = Logger.Logger()
 		if (isa_pointer != None) and (Utilities.is_valid_pointer(isa_pointer.GetValueAsUnsigned(),params.pointer_size, allow_tagged=False)):
 			self.sys_params = params
 			self.valobj = isa_pointer
 			self.check_valid()
 		else:
+			logger >> "Marking as invalid - isa is invalid or None"
 			self.valid = False
 		if self.valid:
 			self.rwt = self.valobj.CreateValueFromAddress("rwt",self.dataPointer,self.sys_params.types_cache.addr_ptr_type).AddressOf()
@@ -193,45 +214,56 @@
 	# this call tries to minimize the amount of data fetched- as soon as we have "proven"
 	# that we have an invalid object, we stop reading
 	def check_valid(self):
+		logger = Logger.Logger()
 		self.valid = True
 		
 		self.isaPointer = Utilities.read_child_of(self.valobj,0,self.sys_params.types_cache.addr_ptr_type)
 		if not(Utilities.is_valid_pointer(self.isaPointer,self.sys_params.pointer_size,allow_tagged=False)):
+			logger >> "Marking as invalid - isaPointer is invalid"
 			self.valid = False
 			return
 		if not(Utilities.is_allowed_pointer(self.isaPointer)):
+			logger >> "Marking as invalid - isaPointer is not allowed"
 			self.valid = False
 			return
 
 		self.cachePointer = Utilities.read_child_of(self.valobj,2*self.sys_params.pointer_size,self.sys_params.types_cache.addr_ptr_type)
 		if not(Utilities.is_valid_pointer(self.cachePointer,self.sys_params.pointer_size,allow_tagged=False)):
+			logger >> "Marking as invalid - cachePointer is invalid"
 			self.valid = False
 			return
 		if not(Utilities.is_allowed_pointer(self.cachePointer)):
+			logger >> "Marking as invalid - cachePointer is not allowed"
 			self.valid = False
 			return
 
 		self.vtablePointer = Utilities.read_child_of(self.valobj,3*self.sys_params.pointer_size,self.sys_params.types_cache.addr_ptr_type)
 		if not(Utilities.is_valid_pointer(self.vtablePointer,self.sys_params.pointer_size,allow_tagged=False)):
+			logger >> "Marking as invalid - vtablePointer is invalid"
 			self.valid = False
 			return
 		if not(Utilities.is_allowed_pointer(self.vtablePointer)):
+			logger >> "Marking as invalid - vtablePointer is not allowed"
 			self.valid = False
 			return
 
 		self.dataPointer = Utilities.read_child_of(self.valobj,4*self.sys_params.pointer_size,self.sys_params.types_cache.addr_ptr_type)
 		if not(Utilities.is_valid_pointer(self.dataPointer,self.sys_params.pointer_size,allow_tagged=False)):
+			logger >> "Marking as invalid - dataPointer is invalid"
 			self.valid = False
 			return
 		if not(Utilities.is_allowed_pointer(self.dataPointer)):
+			logger >> "Marking as invalid - dataPointer is not allowed"
 			self.valid = False
 			return
 
 		self.superclassIsaPointer = Utilities.read_child_of(self.valobj,1*self.sys_params.pointer_size,self.sys_params.types_cache.addr_ptr_type)
 		if not(Utilities.is_valid_pointer(self.superclassIsaPointer,self.sys_params.pointer_size,allow_tagged=False, allow_NULL=True)):
+			logger >> "Marking as invalid - superclassIsa is invalid"
 			self.valid = False
 			return
 		if not(Utilities.is_allowed_pointer(self.superclassIsaPointer)):
+			logger >> "Marking as invalid - superclassIsa is not allowed"
 			self.valid = False
 			return
 
@@ -240,6 +272,7 @@
 	# internally to implement the feature - this method will have no clue that a class
 	# has been KVO'ed unless the standard implementation technique is used
 	def is_kvo(self):
+		logger = Logger.Logger()
 		if self.is_valid():
 			if self.class_name().startswith("NSKVONotifying_"):
 				return True
@@ -250,10 +283,12 @@
 	# which is __NSCFType (the versions without __ also exists and we are matching to it
 	#                      just to be on the safe side)
 	def is_cftype(self):
+		logger = Logger.Logger()
 		if self.is_valid():
 			return self.class_name() == '__NSCFType' or self.class_name() == 'NSCFType'
 
 	def get_superclass(self):
+		logger = Logger.Logger()
 		if self.is_valid():
 			parent_isa_pointer = self.valobj.CreateChildAtOffset("parent_isa",
 				self.sys_params.pointer_size,
@@ -263,17 +298,20 @@
 			return None
 
 	def class_name(self):
+		logger = Logger.Logger()
 		if self.is_valid():
 			return self.data.data.name
 		else:
 			return None
 
 	def is_valid(self):
+		logger = Logger.Logger()
 		if self.valid:
 			return self.data.is_valid()
 		return False
 
 	def __str__(self):
+		logger = Logger.Logger()
 		return 'isaPointer = ' + hex(self.isaPointer) + "\n" + \
 		 "superclassIsaPointer = " + hex(self.superclassIsaPointer) + "\n" + \
 		 "cachePointer = " + hex(self.cachePointer) + "\n" + \
@@ -284,6 +322,7 @@
 		return False
 
 	def instance_size(self,align=False):
+		logger = Logger.Logger()
 		if self.is_valid() == False:
 			return None
 		return self.rwt.rot.instance_size(align)
@@ -291,29 +330,35 @@
 # runtime v1 is much less intricate than v2 and stores relevant information directly in the class_t object
 class Class_Data_V1:
 	def __init__(self,isa_pointer,params):
+		logger = Logger.Logger()
 		if (isa_pointer != None) and (Utilities.is_valid_pointer(isa_pointer.GetValueAsUnsigned(),params.pointer_size, allow_tagged=False)):
 			self.valid = True
 			self.sys_params = params
 			self.valobj = isa_pointer
 			self.check_valid()
 		else:
+			logger >> "Marking as invalid - isaPointer is invalid or None"
 			self.valid = False
 		if self.valid:
 			self.name = Utilities.read_ascii(self.valobj.GetTarget().GetProcess(),self.namePointer)
 			if not(Utilities.is_valid_identifier(self.name)):
+				logger >> "Marking as invalid - name is not valid"
 				self.valid = False
 
 	# perform sanity checks on the contents of this class_t
 	def check_valid(self):
+		logger = Logger.Logger()
 		self.valid = True
 
 		self.isaPointer = Utilities.read_child_of(self.valobj,0,self.sys_params.types_cache.addr_ptr_type)
 		if not(Utilities.is_valid_pointer(self.isaPointer,self.sys_params.pointer_size,allow_tagged=False)):
+			logger >> "Marking as invalid - isaPointer is invalid"
 			self.valid = False
 			return
 
 		self.superclassIsaPointer = Utilities.read_child_of(self.valobj,1*self.sys_params.pointer_size,self.sys_params.types_cache.addr_ptr_type)
 		if not(Utilities.is_valid_pointer(self.superclassIsaPointer,self.sys_params.pointer_size,allow_tagged=False,allow_NULL=True)):
+			logger >> "Marking as invalid - superclassIsa is invalid"
 			self.valid = False
 			return
 
@@ -327,6 +372,7 @@
 	# internally to implement the feature - this method will have no clue that a class
 	# has been KVO'ed unless the standard implementation technique is used
 	def is_kvo(self):
+		logger = Logger.Logger()
 		if self.is_valid():
 			if self.class_name().startswith("NSKVONotifying_"):
 				return True
@@ -337,10 +383,12 @@
 	# which is __NSCFType (the versions without __ also exists and we are matching to it
 	#                      just to be on the safe side)
 	def is_cftype(self):
+		logger = Logger.Logger()
 		if self.is_valid():
 			return self.class_name() == '__NSCFType' or self.class_name() == 'NSCFType'
 
 	def get_superclass(self):
+		logger = Logger.Logger()
 		if self.is_valid():
 			parent_isa_pointer = self.valobj.CreateChildAtOffset("parent_isa",
 				self.sys_params.pointer_size,
@@ -350,6 +398,7 @@
 			return None
 
 	def class_name(self):
+		logger = Logger.Logger()
 		if self.is_valid():
 			return self.name
 		else:
@@ -359,6 +408,7 @@
 		return self.valid
 
 	def __str__(self):
+		logger = Logger.Logger()
 		return 'isaPointer = ' + hex(self.isaPointer) + "\n" + \
 		 "superclassIsaPointer = " + hex(self.superclassIsaPointer) + "\n" + \
 		 "namePointer = " + hex(self.namePointer) + " --> " + self.name + \
@@ -368,6 +418,7 @@
 		return False
 
 	def instance_size(self,align=False):
+		logger = Logger.Logger()
 		if self.is_valid() == False:
 			return None
 		if self.instanceSize == None:
@@ -397,6 +448,7 @@
 
 class TaggedClass_Data:
 	def __init__(self,pointer,params):
+		logger = Logger.Logger()
 		global TaggedClass_Values_Lion,TaggedClass_Values_NMOS
 		self.valid = True
 		self.name = None
@@ -410,11 +462,13 @@
 			if self.class_bits in TaggedClass_Values_Lion:
 				self.name = TaggedClass_Values_Lion[self.class_bits]
 			else:
+				logger >> "Marking as invalid - not a good tagged pointer for Lion"
 				self.valid = False
 		else:
 			if self.class_bits in TaggedClass_Values_NMOS:
 				self.name = TaggedClass_Values_NMOS[self.class_bits]
 			else:
+				logger >> "Marking as invalid - not a good tagged pointer for NMOS"
 				self.valid = False
 
 
@@ -422,6 +476,7 @@
 		return self.valid
 
 	def class_name(self):
+		logger = Logger.Logger()
 		if self.is_valid():
 			return self.name
 		else:
@@ -451,6 +506,7 @@
 
 	# it seems reasonable to say that a tagged pointer is the size of a pointer
 	def instance_size(self,align=False):
+		logger = Logger.Logger()
 		if self.is_valid() == False:
 			return None
 		return self.sys_params.pointer_size
@@ -508,10 +564,12 @@
 
 class SystemParameters:
 	def __init__(self,valobj):
+		logger = Logger.Logger()
 		self.adjust_for_architecture(valobj)
 		self.adjust_for_process(valobj)
 
 	def adjust_for_process(self, valobj):
+		logger = Logger.Logger()
 		global runtime_version
 		global os_version
 		global types_caches
@@ -570,7 +628,9 @@
 	# of a well-known section only present in v1
 	@staticmethod
 	def runtime_version(process):
+		logger = Logger.Logger()
 		if process.IsValid() == False:
+			logger >> "No process - bailing out"
 			return None
 		target = process.GetTarget()
 		num_modules = target.GetNumModules()
@@ -581,6 +641,7 @@
 				module_objc = module
 				break
 		if module_objc == None or module_objc.IsValid() == False:
+			logger >> "no libobjc - bailing out"
 			return None
 		num_sections = module.GetNumSections()
 		section_objc = None
@@ -590,16 +651,20 @@
 				section_objc = section
 				break
 		if section_objc != None and section_objc.IsValid():
+			logger >> "found __OBJC: v1"
 			return 1
+		logger >> "no __OBJC: v2"
 		return 2
 
 	@staticmethod
 	def runtime_from_isa(isa):
+		logger = Logger.Logger()
 		runtime = ObjCRuntime(isa)
 		runtime.isa = isa
 		return runtime
 
 	def __init__(self,valobj):
+		logger = Logger.Logger()
 		self.valobj = valobj
 		self.adjust_for_architecture()
 		self.sys_params = SystemParameters(self.valobj)
@@ -611,12 +676,14 @@
 
 # an ObjC pointer can either be tagged or must be aligned
 	def is_tagged(self):
+		logger = Logger.Logger()
 		if self.valobj is None:
 			return False
 		return (Utilities.is_valid_pointer(self.unsigned_value,self.sys_params.pointer_size, allow_tagged=True) and \
 		not(Utilities.is_valid_pointer(self.unsigned_value,self.sys_params.pointer_size, allow_tagged=False)))
 
 	def is_valid(self):
+		logger = Logger.Logger()
 		if self.valobj is None:
 			return False
 		if self.valobj.IsInScope() == False:
@@ -627,29 +694,41 @@
 		return self.unsigned_value == 0
 
 	def read_isa(self):
+		logger = Logger.Logger()
 		if self.isa_value != None:
+			logger >> "using cached isa"
 			return self.isa_value
 		isa_pointer = self.valobj.CreateChildAtOffset("cfisa",
 			0,
 			self.sys_params.types_cache.addr_ptr_type)
 		if isa_pointer == None or isa_pointer.IsValid() == False:
+			logger >> "invalid isa - bailing out"
 			return None;
 		if isa_pointer.GetValueAsUnsigned(1) == 1:
+			logger >> "invalid isa value - bailing out"
 			return None;
 		self.isa_value = isa_pointer
 		return isa_pointer
 
 	def read_class_data(self):
+		logger = Logger.Logger()
 		global isa_cache
 		if self.is_tagged():
 			# tagged pointers only exist in ObjC v2
 			if self.sys_params.runtime_version == 2:
+				logger >> "on v2 and tagged - maybe"
 				# not every odd-valued pointer is actually tagged. most are just plain wrong
 				# we could try and predetect this before even creating a TaggedClass_Data object
 				# but unless performance requires it, this seems a cleaner way to tackle the task
 				tentative_tagged = TaggedClass_Data(self.unsigned_value,self.sys_params)
-				return tentative_tagged if tentative_tagged.is_valid() else InvalidClass_Data()
+				if tentative_tagged.is_valid():
+					logger >> "truly tagged"
+					return tentative_tagged
+				else:
+					logger >> "not tagged - error"
+					return InvalidClass_Data()
 			else:
+				logger >> "on v1 and tagged - error"
 				return InvalidClass_Data()
 		if self.is_valid() == False:
 			return InvalidClass_Data()





More information about the lldb-commits mailing list