[Lldb-commits] [lldb] r161111 - /lldb/trunk/examples/summaries/cocoa/objc_runtime.py

Filipe Cabecinhas me at filcab.net
Wed Aug 1 07:38:38 PDT 2012


Author: filcab
Date: Wed Aug  1 09:38:37 2012
New Revision: 161111

URL: http://llvm.org/viewvc/llvm-project?rev=161111&view=rev
Log:
Make the objc-runtime work with Python 2.6

Modified:
    lldb/trunk/examples/summaries/cocoa/objc_runtime.py

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=161111&r1=161110&r2=161111&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/objc_runtime.py (original)
+++ lldb/trunk/examples/summaries/cocoa/objc_runtime.py Wed Aug  1 09:38:37 2012
@@ -220,7 +220,7 @@
 	def check_valid(self):
 		logger = lldb.formatters.Logger.Logger()
 		self.valid = 1
-	
+
 		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=0)):
 			logger >> "Marking as invalid - isaPointer is invalid"
@@ -461,7 +461,7 @@
 		self.val = (pointer & ~0x0000000000000000FF) >> 8
 		self.class_bits = (pointer & 0xE) >> 1
 		self.i_bits = (pointer & 0xF0) >> 4
-		
+
 		if self.sys_params.is_lion:
 			if self.class_bits in TaggedClass_Values_Lion:
 				self.name = TaggedClass_Values_Lion[self.class_bits]
@@ -522,7 +522,7 @@
 	def is_valid(self):
 		return 0
 
- at functools.total_ordering
+
 class Version:
 	def __init__(self, major, minor, release, build_string):
 		self._major = major
@@ -561,6 +561,18 @@
 		       (self.release == other.release) and \
 		       (self.build_string == other.build_string)
 
+	# Python 2.6 doesn't have functools.total_ordering, so we have to implement
+	# other comparators
+	def __gt__(self, other):
+		return other < self
+
+	def __le__(self, other):
+		return not other < self
+
+	def __ge__(self, other):
+		return not self < other
+
+
 runtime_version = lldb.formatters.cache.Cache()
 os_version = lldb.formatters.cache.Cache()
 types_caches = lldb.formatters.cache.Cache()
@@ -578,22 +590,22 @@
 		global os_version
 		global types_caches
 		global isa_caches
-		
+
 		process = valobj.GetTarget().GetProcess()
 		self.pid = process.GetProcessID()
-		
+
 		if runtime_version.look_for_key(self.pid):
 			self.runtime_version = runtime_version.get_value(self.pid)
 		else:
 			self.runtime_version = ObjCRuntime.runtime_version(process)
 			runtime_version.add_item(self.pid,self.runtime_version)
-		
+
 		if os_version.look_for_key(self.pid):
 			self.is_lion = os_version.get_value(self.pid)
 		else:
 			self.is_lion = Utilities.check_is_osx_lion(valobj.GetTarget())
 			os_version.add_item(self.pid,self.is_lion)
-		
+
 		if types_caches.look_for_key(self.pid):
 			self.types_cache = types_caches.get_value(self.pid)
 		else:
@@ -602,7 +614,7 @@
 			self.types_cache.addr_ptr_type = self.types_cache.addr_type.GetPointerType()
 			self.types_cache.uint32_t = valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
 			types_caches.add_item(self.pid,self.types_cache)
-		
+
 		if isa_caches.look_for_key(self.pid):
 			self.isa_cache = isa_caches.get_value(self.pid)
 		else:





More information about the lldb-commits mailing list