summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2012-10-05 22:58:46 +0000
committerEnrico Granata <egranata@apple.com>2012-10-05 22:58:46 +0000
commite3fcd2bb5331ab3b18884a1110900358894fe0ad (patch)
tree0cf1300e1386d39ef6b7ee946201a78085ccdbbe
parent675e45c770b7857d0eb4b3203a6b20ce8de79d7f (diff)
downloadbcm5719-llvm-e3fcd2bb5331ab3b18884a1110900358894fe0ad.tar.gz
bcm5719-llvm-e3fcd2bb5331ab3b18884a1110900358894fe0ad.zip
<rdar://problem/12426557> Fixing the NSIndexSet data formatter
llvm-svn: 165341
-rw-r--r--lldb/examples/summaries/cocoa/NSIndexSet.py29
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-objc/main.m2
2 files changed, 19 insertions, 12 deletions
diff --git a/lldb/examples/summaries/cocoa/NSIndexSet.py b/lldb/examples/summaries/cocoa/NSIndexSet.py
index a1129014135..a1656fe9008 100644
--- a/lldb/examples/summaries/cocoa/NSIndexSet.py
+++ b/lldb/examples/summaries/cocoa/NSIndexSet.py
@@ -32,8 +32,12 @@ class NSIndexSetClass_SummaryProvider:
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 @@ class NSIndexSetClass_SummaryProvider:
# 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 @@ class NSIndexSetClass_SummaryProvider:
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)
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-objc/main.m b/lldb/test/functionalities/data-formatter/data-formatter-objc/main.m
index eebe9f3fba3..56087ae4a2e 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-objc/main.m
+++ b/lldb/test/functionalities/data-formatter/data-formatter-objc/main.m
@@ -556,7 +556,7 @@ int main (int argc, const char * argv[])
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];
OpenPOWER on IntegriCloud