[Lldb-commits] [lldb] r165341 - in /lldb/trunk: examples/summaries/cocoa/NSIndexSet.py test/functionalities/data-formatter/data-formatter-objc/main.m
Enrico Granata
egranata at apple.com
Fri Oct 5 15:58:46 PDT 2012
Author: enrico
Date: Fri Oct 5 17:58:46 2012
New Revision: 165341
URL: http://llvm.org/viewvc/llvm-project?rev=165341&view=rev
Log:
<rdar://problem/12426557> Fixing the NSIndexSet data formatter
Modified:
lldb/trunk/examples/summaries/cocoa/NSIndexSet.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m
Modified: lldb/trunk/examples/summaries/cocoa/NSIndexSet.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSIndexSet.py?rev=165341&r1=165340&r2=165341&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSIndexSet.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSIndexSet.py Fri Oct 5 17:58:46 2012
@@ -32,8 +32,12 @@
if not(self.sys_params.types_cache.NSUInteger):
if self.sys_params.is_64_bit:
self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLong)
+ self.sys_params.types_cache.uint32 = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
else:
self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
+ self.sys_params.types_cache.uint32 = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
+ if not(self.sys_params.types_cache.uint32):
+ self.sys_params.types_cache.uint32 = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
self.update();
def update(self):
@@ -44,21 +48,22 @@
# the count is stored in the set itself, 3 pointers into it
# otherwise, it will store a pointer to an additional data structure (2 pointers into itself) and this
# additional structure will contain the count two pointers deep
- # to distinguish the two modes, one reads two pointers deep into the object data: if only the MSB
- # 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
+ # a bunch of flags allow us to detect an empty set, vs. a one-range set, vs. a multi-range set
def count(self):
logger = lldb.formatters.Logger.Logger()
mode_chooser_vo = self.valobj.CreateChildAtOffset("mode_chooser",
- 2*self.sys_params.pointer_size,
- self.sys_params.types_cache.NSUInteger)
+ self.sys_params.pointer_size,
+ self.sys_params.types_cache.uint32)
mode_chooser = mode_chooser_vo.GetValueAsUnsigned(0)
if self.sys_params.is_64_bit:
- mode_chooser = mode_chooser & 0xFFFFFFFFFFFFFF00
- else:
- mode_chooser = mode_chooser & 0xFFFFFF00
- if mode_chooser == 0:
+ mode_chooser = mode_chooser & 0x00000000FFFFFFFF
+ # empty set
+ if mode_chooser & 0x01 == 1:
+ return 0
+ # single range
+ if mode_chooser & 0x02 == 2:
mode = 1
+ # multi range
else:
mode = 2
if mode == 1:
@@ -66,9 +71,11 @@
3*self.sys_params.pointer_size,
self.sys_params.types_cache.NSUInteger)
else:
- count_ptr = mode_chooser_vo.GetValueAsUnsigned(0)
+ count_ptr = self.valobj.CreateChildAtOffset("count_ptr",
+ 2*self.sys_params.pointer_size,
+ self.sys_params.types_cache.NSUInteger)
count_vo = self.valobj.CreateValueFromAddress("count",
- count_ptr+2*self.sys_params.pointer_size,
+ count_ptr.GetValueAsUnsigned()+2*self.sys_params.pointer_size,
self.sys_params.types_cache.NSUInteger)
return count_vo.GetValueAsUnsigned(0)
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m?rev=165341&r1=165340&r2=165341&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m Fri Oct 5 17:58:46 2012
@@ -556,7 +556,7 @@
NSIndexSet *iset2 = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(1, 512)];
NSMutableIndexSet *imset = [[NSMutableIndexSet alloc] init];
- [imset addIndex:4];
+ [imset addIndex:1936];
[imset addIndex:7];
[imset addIndex:9];
[imset addIndex:11];
More information about the lldb-commits
mailing list