diff options
-rw-r--r-- | lldb/examples/summaries/cocoa/CFString.py | 8 | ||||
-rw-r--r-- | lldb/examples/summaries/cocoa/NSDate.py | 60 | ||||
-rw-r--r-- | lldb/examples/summaries/cocoa/NSIndexSet.py | 130 | ||||
-rw-r--r-- | lldb/examples/summaries/cocoa/NSNumber.py | 12 | ||||
-rw-r--r-- | lldb/examples/summaries/cocoa/NSSet.py | 33 | ||||
-rwxr-xr-x | lldb/scripts/Python/finish-swig-Python-LLDB.sh | 14 | ||||
-rw-r--r-- | lldb/source/Core/FormatManager.cpp | 13 | ||||
-rw-r--r-- | lldb/source/Interpreter/ScriptInterpreterPython.cpp | 2 | ||||
-rw-r--r-- | lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py | 86 | ||||
-rw-r--r-- | lldb/test/functionalities/data-formatter/data-formatter-objc/main.m | 35 |
10 files changed, 376 insertions, 17 deletions
diff --git a/lldb/examples/summaries/cocoa/CFString.py b/lldb/examples/summaries/cocoa/CFString.py index 13d825ee715..80fa71b62e5 100644 --- a/lldb/examples/summaries/cocoa/CFString.py +++ b/lldb/examples/summaries/cocoa/CFString.py @@ -1,6 +1,7 @@ # synthetic children and summary provider for CFString # (and related NSString class) import lldb +import objc_runtime def CFString_SummaryProvider (valobj,dict): provider = CFStringSynthProvider(valobj,dict); @@ -109,7 +110,12 @@ class CFStringSynthProvider: # content begins at * (i.e. 8 bytes into variants, skipping void* buffer in # __notInlineImmutable1 entirely, while the length byte is correctly located # for an inline string) - pointer = pointer + 8; + # on NMOS in 32 bit mode, we need to skip 4 bytes instead of why + # if the same occurs on Lion, then this simply needs to be pointer + pointer_size + if self.is_64_bit == False and objc_runtime.Utilities.check_is_osx_lion(self.valobj.GetTarget()) == False: + pointer = pointer + 4 + else: + pointer = pointer + 8; else: pointer = self.valobj.GetValueAsUnsigned(0) + self.size_of_cfruntime_base(); # read 8 bytes here and make an address out of them diff --git a/lldb/examples/summaries/cocoa/NSDate.py b/lldb/examples/summaries/cocoa/NSDate.py index aa059e2e79c..df493cbc070 100644 --- a/lldb/examples/summaries/cocoa/NSDate.py +++ b/lldb/examples/summaries/cocoa/NSDate.py @@ -25,14 +25,14 @@ def mkgmtime(t): osx_epoch = mkgmtime(osx_epoch) def osx_to_python_time(osx): - if python_epoch <= 2011: + if python_epoch <= 2001: return osx + osx_epoch else: return osx - osx_epoch # despite the similary to synthetic children providers, these classes are not -# trying to provide anything but the port number of an NSDate, so they need not +# trying to provide anything but the summary for NSDate, so they need not # obey the interface specification for synthetic children providers class NSTaggedDate_SummaryProvider: def adjust_for_architecture(self): @@ -43,8 +43,9 @@ class NSTaggedDate_SummaryProvider: def __init__(self, valobj, info_bits, data): self.valobj = valobj; self.update(); - self.info_bits = info_bits - self.data = data + # NSDate is not using its info_bits for info like NSNumber is + # so we need to regroup info_bits and data + self.data = ((data << 8) | (info_bits << 4)) def update(self): self.adjust_for_architecture(); @@ -63,10 +64,12 @@ class NSTaggedDate_SummaryProvider: def value(self): # the value of the date-time object is wrapped into the pointer value - # unfortunately, it is made as a time-delta after Jan 1 2011 midnight GMT + # 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 # year (1970 of *nix) whose Jan 1 at midnight is taken as reference - return time.ctime(osx_to_python_time(self.data)) + print hex(self.data) + value_double = struct.unpack('d', struct.pack('Q', self.data))[0] + return time.ctime(osx_to_python_time(value_double)) class NSUntaggedDate_SummaryProvider: @@ -99,6 +102,37 @@ class NSUntaggedDate_SummaryProvider: value_double = struct.unpack('d', struct.pack('Q', value.GetValueAsUnsigned(0)))[0] return time.ctime(osx_to_python_time(value_double)) +class NSCalendarDate_SummaryProvider: + def adjust_for_architecture(self): + self.is_64_bit = (self.valobj.GetTarget().GetProcess().GetAddressByteSize() == 8) + self.is_little = (self.valobj.GetTarget().GetProcess().GetByteOrder() == lldb.eByteOrderLittle) + self.pointer_size = self.valobj.GetTarget().GetProcess().GetAddressByteSize() + + def __init__(self, valobj): + self.valobj = valobj; + self.update() + + def update(self): + self.adjust_for_architecture(); + self.id_type = self.valobj.GetType().GetBasicType(lldb.eBasicTypeObjCID) + self.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLong) + self.double = self.valobj.GetType().GetBasicType(lldb.eBasicTypeDouble) + + def offset(self): + if self.is_64_bit: + return 16 + else: + return 8 + + + def value(self): + value = self.valobj.CreateChildAtOffset("value", + self.offset(), + self.double) + value_double = struct.unpack('d', struct.pack('Q', value.GetValueAsUnsigned(0)))[0] + return time.ctime(osx_to_python_time(value_double)) + + class NSUnknownDate_SummaryProvider: def adjust_for_architecture(self): self.is_64_bit = (self.valobj.GetTarget().GetProcess().GetAddressByteSize() == 8) @@ -147,7 +181,11 @@ def GetSummary_Impl(valobj): else: wrapper = NSUntaggedDate_SummaryProvider(valobj) statistics.metric_hit('code_notrun',valobj) + elif name_string == 'NSCalendarDate': + wrapper = NSCalendarDate_SummaryProvider(valobj) + statistics.metric_hit('code_notrun',valobj) else: + print name_string # comment this out in release mode wrapper = NSUnknownDate_SummaryProvider(valobj) statistics.metric_hit('unknown_class',str(valobj) + " seen as " + name_string) return wrapper; @@ -161,11 +199,19 @@ def NSDate_SummaryProvider (valobj,dict): #except: # summary = None if summary == None: - summary = 'no valid number here' + summary = 'no valid date here' return str(summary) return '' +def CFAbsoluteTime_SummaryProvider (valobj,dict): + try: + value_double = struct.unpack('d', struct.pack('Q', valobj.GetValueAsUnsigned(0)))[0] + return time.ctime(osx_to_python_time(value_double)) + except: + return 'unable to provide a summary' + def __lldb_init_module(debugger,dict): debugger.HandleCommand("type summary add -F NSDate.NSDate_SummaryProvider NSDate") + debugger.HandleCommand("type summary add -F NSDate.CFAbsoluteTime_SummaryProvider CFAbsoluteTime") diff --git a/lldb/examples/summaries/cocoa/NSIndexSet.py b/lldb/examples/summaries/cocoa/NSIndexSet.py new file mode 100644 index 00000000000..c030e16d388 --- /dev/null +++ b/lldb/examples/summaries/cocoa/NSIndexSet.py @@ -0,0 +1,130 @@ +# summary provider for NS(Mutable)IndexSet +import lldb +import ctypes +import objc_runtime +import metrics + +statistics = metrics.Metrics() +statistics.add_metric('invalid_isa') +statistics.add_metric('invalid_pointer') +statistics.add_metric('unknown_class') +statistics.add_metric('code_notrun') + +# despite the similary to synthetic children providers, these classes are not +# trying to provide anything but the count of values for an NSIndexSet, so they need not +# obey the interface specification for synthetic children providers +class NSIndexSetClass_SummaryProvider: + def adjust_for_architecture(self): + self.is_64_bit = (self.valobj.GetTarget().GetProcess().GetAddressByteSize() == 8) + self.is_little = (self.valobj.GetTarget().GetProcess().GetByteOrder() == lldb.eByteOrderLittle) + self.pointer_size = self.valobj.GetTarget().GetProcess().GetAddressByteSize() + + def __init__(self, valobj): + self.valobj = valobj; + self.update(); + + def update(self): + self.adjust_for_architecture(); + self.id_type = self.valobj.GetType().GetBasicType(lldb.eBasicTypeObjCID) + self.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLong) + + # NS(Mutable)IndexSet works in one of two modes: when having a compact block of data (e.g. a Range) + # 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 + def count(self): + mode_chooser_vo = self.valobj.CreateChildAtOffset("mode_chooser", + 2*self.pointer_size, + self.NSUInteger) + mode_chooser = mode_chooser_vo.GetValueAsUnsigned(0) + if self.is_64_bit: + mode_chooser = mode_chooser & 0xFFFFFFFFFFFFFF00 + else: + mode_chooser = mode_chooser & 0xFFFFFF00 + if mode_chooser == 0: + mode = 1 + else: + mode = 2 + if mode == 1: + count_vo = self.valobj.CreateChildAtOffset("count", + 3*self.pointer_size, + self.NSUInteger) + else: + count_ptr = mode_chooser_vo.GetValueAsUnsigned(0) + count_vo = self.valobj.CreateValueFromAddress("count", + count_ptr+2*self.pointer_size, + self.NSUInteger) + return count_vo.GetValueAsUnsigned(0) + + +class NSIndexSetUnknown_SummaryProvider: + def adjust_for_architecture(self): + self.is_64_bit = (self.valobj.GetTarget().GetProcess().GetAddressByteSize() == 8) + self.is_little = (self.valobj.GetTarget().GetProcess().GetByteOrder() == lldb.eByteOrderLittle) + self.pointer_size = self.valobj.GetTarget().GetProcess().GetAddressByteSize() + + def __init__(self, valobj): + self.valobj = valobj; + self.update() + + def update(self): + self.adjust_for_architecture(); + self.id_type = self.valobj.GetType().GetBasicType(lldb.eBasicTypeObjCID) + + def count(self): + stream = lldb.SBStream() + self.valobj.GetExpressionPath(stream) + expr = "(int)[" + stream.GetData() + " count]" + num_children_vo = self.valobj.CreateValueFromExpression("count",expr); + return num_children_vo.GetValueAsUnsigned(0) + + +def GetSummary_Impl(valobj): + global statistics + class_data = objc_runtime.ObjCRuntime(valobj) + if class_data.is_valid() == False: + statistics.metric_hit('invalid_pointer',valobj) + wrapper = None + return + class_data = class_data.read_class_data() + if class_data.is_valid() == False: + statistics.metric_hit('invalid_isa',valobj) + wrapper = None + return + if class_data.is_kvo(): + class_data = class_data.get_superclass() + if class_data.is_valid() == False: + statistics.metric_hit('invalid_isa',valobj) + wrapper = None + return + + name_string = class_data.class_name() + if name_string == 'NSIndexSet' or name_string == 'NSMutableIndexSet': + wrapper = NSIndexSetClass_SummaryProvider(valobj) + statistics.metric_hit('code_notrun',valobj) + else: + wrapper = NSIndexSetUnknown_SummaryProvider(valobj) + statistics.metric_hit('unknown_class',str(valobj) + " seen as " + name_string) + return wrapper; + + +def NSIndexSet_SummaryProvider (valobj,dict): + provider = GetSummary_Impl(valobj); + if provider != None: + try: + summary = provider.count(); + except: + summary = None + if summary == None: + summary = 'no valid set here' + else: + summary = str(summary) + ' objects' + return summary + return '' + + +def __lldb_init_module(debugger,dict): + debugger.HandleCommand("type summary add -F NSIndexSet.NSIndexSet_SummaryProvider NSIndexSet NSMutableIndexSet") diff --git a/lldb/examples/summaries/cocoa/NSNumber.py b/lldb/examples/summaries/cocoa/NSNumber.py index dfe0917b11d..7726dedb179 100644 --- a/lldb/examples/summaries/cocoa/NSNumber.py +++ b/lldb/examples/summaries/cocoa/NSNumber.py @@ -116,8 +116,16 @@ class NSUntaggedNumber_SummaryProvider: return '(int)' + str(data_vo.GetValueAsUnsigned(0) % (256*256*256*256)) # apparently, on is_64_bit architectures, these are the only values that will ever # be represented by a non tagged pointers - elif data_type == 0B10001 or data_type == 0B0100: - data_offset = data_offset + self.pointer_size + elif data_type == 0B10001: + data_offset = data_offset + 8 # 8 is needed even if we are on 32bit + data_vo = self.valobj.CreateChildAtOffset("data", + data_offset, + self.longlong) + statistics.metric_hit('code_notrun',self.valobj) + return '(long)' + str(data_vo.GetValueAsUnsigned(0)) + elif data_type == 0B0100: + if self.is_64_bit: + data_offset = data_offset + self.pointer_size data_vo = self.valobj.CreateChildAtOffset("data", data_offset, self.longlong) diff --git a/lldb/examples/summaries/cocoa/NSSet.py b/lldb/examples/summaries/cocoa/NSSet.py index ee3072da2dc..17ca6d39d7c 100644 --- a/lldb/examples/summaries/cocoa/NSSet.py +++ b/lldb/examples/summaries/cocoa/NSSet.py @@ -3,6 +3,7 @@ import lldb import ctypes import objc_runtime import metrics +import CFBag statistics = metrics.Metrics() statistics.add_metric('invalid_isa') @@ -138,6 +139,35 @@ class NSSetM_SummaryProvider: return num_children_vo.GetValueAsUnsigned(0) +class NSCountedSet_SummaryProvider: + def adjust_for_architecture(self): + self.is_64_bit = (self.valobj.GetTarget().GetProcess().GetAddressByteSize() == 8) + self.is_little = (self.valobj.GetTarget().GetProcess().GetByteOrder() == lldb.eByteOrderLittle) + self.pointer_size = self.valobj.GetTarget().GetProcess().GetAddressByteSize() + + def __init__(self, valobj): + self.valobj = valobj; + self.update(); + + def update(self): + self.adjust_for_architecture(); + self.id_type = self.valobj.GetType().GetBasicType(lldb.eBasicTypeObjCID) + self.voidptr_type = self.valobj.GetType().GetBasicType(lldb.eBasicTypeVoid).GetPointerType() + + # an NSCountedSet is implemented using a CFBag whose pointer just follows the ISA + def offset(self): + if self.is_64_bit: + return 8 + else: + return 4 + + def count(self): + cfbag_vo = self.valobj.CreateChildAtOffset("bag_impl", + self.offset(), + self.voidptr_type) + return CFBag.CFBagRef_SummaryProvider(cfbag_vo).length() + + def GetSummary_Impl(valobj): global statistics class_data = objc_runtime.ObjCRuntime(valobj) @@ -167,6 +197,9 @@ def GetSummary_Impl(valobj): elif name_string == '__NSSetM': wrapper = NSSetM_SummaryProvider(valobj) statistics.metric_hit('code_notrun',valobj) + elif name_string == 'NSCountedSet': + wrapper = NSCountedSet_SummaryProvider(valobj) + statistics.metric_hit('code_notrun',valobj) else: wrapper = NSSetUnknown_SummaryProvider(valobj) statistics.metric_hit('unknown_class',str(valobj) + " seen as " + name_string) diff --git a/lldb/scripts/Python/finish-swig-Python-LLDB.sh b/lldb/scripts/Python/finish-swig-Python-LLDB.sh index aabd94d8087..66dfd9978ce 100755 --- a/lldb/scripts/Python/finish-swig-Python-LLDB.sh +++ b/lldb/scripts/Python/finish-swig-Python-LLDB.sh @@ -396,6 +396,20 @@ else fi fi +if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSIndexSet.py" ] +then + if [ $Debug == 1 ] + then + echo "Copying NSIndexSet.py to ${framework_python_dir}" + fi + cp "${SRC_ROOT}/examples/summaries/cocoa/NSIndexSet.py" "${framework_python_dir}" +else + if [ $Debug == 1 ] + then + echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSIndexSet.py" + fi +fi + if [ -f "${SRC_ROOT}/examples/summaries/cocoa/cache.py" ] then if [ $Debug == 1 ] diff --git a/lldb/source/Core/FormatManager.cpp b/lldb/source/Core/FormatManager.cpp index af0ef7954c6..4e12903cdcb 100644 --- a/lldb/source/Core/FormatManager.cpp +++ b/lldb/source/Core/FormatManager.cpp @@ -738,7 +738,7 @@ FormatManager::LoadObjCFormatters() ConstString("CFRange"), objc_flags); AddSummary(corefoundation_category_sp, - "x=${var.x}, y=${var.y}", + "(x=${var.x}, y=${var.y})", ConstString("NSPoint"), objc_flags); AddSummary(corefoundation_category_sp, @@ -754,7 +754,7 @@ FormatManager::LoadObjCFormatters() ConstString("NSRectArray"), objc_flags); AddSummary(objc_category_sp, - "width=${var.width}, height=${var.height}", + "(width=${var.width}, height=${var.height})", ConstString("NSSize"), objc_flags); @@ -856,6 +856,15 @@ FormatManager::LoadObjCFormatters() AddScriptSummary(appkit_category_sp, "NSDate.NSDate_SummaryProvider", ConstString("NSDate"), appkit_flags); + // CFAbsoluteTime is actually a double rather than a pointer to an object + // we do not care about the numeric value, since it is probably meaningless to users + appkit_flags.SetDontShowValue(true); + AddScriptSummary(appkit_category_sp, "NSDate.CFAbsoluteTime_SummaryProvider", ConstString("CFAbsoluteTime"), appkit_flags); + appkit_flags.SetDontShowValue(false); + + AddScriptSummary(appkit_category_sp, "NSIndexSet.NSIndexSet_SummaryProvider", ConstString("NSIndexSet"), appkit_flags); + AddScriptSummary(appkit_category_sp, "NSIndexSet.NSIndexSet_SummaryProvider", ConstString("NSMutableIndexSet"), appkit_flags); + TypeCategoryImpl::SharedPointer vectors_category_sp = GetCategory(m_vectortypes_category_name); TypeSummaryImpl::Flags vector_flags; diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp index 246e3bd7b9a..9d0d96983fd 100644 --- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp +++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp @@ -282,7 +282,7 @@ ScriptInterpreterPython::ScriptInterpreterPython (CommandInterpreter &interprete // WARNING: temporary code that loads Cocoa formatters - this should be done on a per-platform basis rather than loading the whole set // and letting the individual formatter classes exploit APIs to check whether they can/cannot do their task run_string.Clear(); - run_string.Printf ("run_one_line (%s, 'import CFString, CFArray, CFDictionary, NSData, NSMachPort, NSSet, NSNotification, NSException, CFBag, CFBinaryHeap, NSURL, NSBundle, NSNumber, NSDate')", m_dictionary_name.c_str()); + run_string.Printf ("run_one_line (%s, 'import CFString, CFArray, CFDictionary, NSData, NSMachPort, NSSet, NSNotification, NSException, CFBag, CFBinaryHeap, NSURL, NSBundle, NSNumber, NSDate, NSIndexSet')", m_dictionary_name.c_str()); PyRun_SimpleString (run_string.GetData()); int new_count = Debugger::TestDebuggerRefCount(); diff --git a/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py b/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py index a6a442a71e9..26bba6214f6 100644 --- a/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py +++ b/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py @@ -6,6 +6,7 @@ import os, time import unittest2 import lldb from lldbtest import * +import datetime class ObjCDataFormatterTestCase(TestBase): @@ -59,6 +60,20 @@ class ObjCDataFormatterTestCase(TestBase): self.buildDwarf() self.kvo_data_formatter_commands() + @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") + @expectedFailurei386 + def test_expr_with_dsym_and_run_command(self): + """Test common cases of expression parser <--> formatters interaction.""" + self.buildDsym() + self.expr_objc_data_formatter_commands() + + @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") + @expectedFailurei386 + def test_expr_with_dwarf_and_run_command(self): + """Test common cases of expression parser <--> formatters interaction.""" + self.buildDwarf() + self.expr_objc_data_formatter_commands() + def setUp(self): # Call super's setUp(). TestBase.setUp(self) @@ -180,7 +195,7 @@ class ObjCDataFormatterTestCase(TestBase): '(NSNumber *) num4 = ',' (long)18446744073709551614', '(NSNumber *) num5 = ',' (char)65', '(NSNumber *) num6 = ',' (long)255', - '(NSNumber *) num7 = ',' (long)2000000', + '(NSNumber *) num7 = ','2000000', '(NSNumber *) num8_Y = ',' @"1"', '(NSNumber *) num8_N = ',' @"0"', '(NSNumber *) num9 = ',' (short)33920']) @@ -252,6 +267,69 @@ class ObjCDataFormatterTestCase(TestBase): self.expect('frame variable port', substrs = ['(NSMachPort *) port = ',' mach port: ']) + self.expect('frame variable date1 date2', + substrs = ['10','1985','1','2011']) + + # this test might fail if we hit the breakpoint late on December 31st of some given year + # and midnight comes between hitting the breakpoint and running this line of code + # hopefully the output will be revealing enough in that case :-) + now_year = str(datetime.datetime.now().year) + + self.expect('frame variable date3 date4', + substrs = [now_year,'1970']) + + self.expect('frame variable date1_abs date2_abs', + substrs = ['10','1985','1','2011']) + + self.expect('frame variable date3_abs date4_abs', + substrs = [now_year,'1970']) + + #self.runCmd('mem read `&date4_abs`') + + #self.runCmd('mem read `nscounted_set`') + + self.expect('frame variable nscounted_set', + substrs = ['(NSCountedSet *) nscounted_set = ','5 objects']) + + #self.runCmd('mem read `imset`') + #self.runCmd("p (int)[imset count]") + + self.expect('frame variable iset1 iset2 imset', + substrs = ['4 objects','512 objects','10 objects']) + + def expr_objc_data_formatter_commands(self): + """Test common cases of expression parser <--> formatters interaction.""" + self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) + + self.expect("breakpoint set -f main.m -l %d" % self.line, + BREAKPOINT_CREATED, + startstr = "Breakpoint created: 1: file ='main.m', line = %d, locations = 1" % + self.line) + + self.runCmd("run", RUN_SUCCEEDED) + + # The stop reason of the thread should be breakpoint. + self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, + substrs = ['stopped', + 'stop reason = breakpoint']) + + # This is the function to remove the custom formats in order to have a + # clean slate for the next test case. + def cleanup(): + self.runCmd('type format clear', check=False) + self.runCmd('type summary clear', check=False) + self.runCmd('type synth clear', check=False) + self.runCmd('type category disable CoreFoundation', check=False) + self.runCmd('type category disable CoreGraphics', check=False) + self.runCmd('type category disable CoreServices', check=False) + self.runCmd('type category disable AppKit', check=False) + + # Execute the cleanup function during test case tear down. + self.addTearDownHook(cleanup) + + # Now enable AppKit + self.runCmd("type category enable AppKit") + # check that the formatters are able to deal safely and correctly # with ValueObjects that the expression parser returns self.expect('expression ((id)@"Hello")', matching=False, @@ -307,13 +385,13 @@ class ObjCDataFormatterTestCase(TestBase): self.expect("frame variable", substrs = ['(CFGregorianUnits) cf_greg_units = 1 years, 3 months, 5 days, 12 hours, 5 minutes 7 seconds', '(CFRange) cf_range = location=4 length=4', - '(NSPoint) ns_point = x=4, y=4', + '(NSPoint) ns_point = (x=4, y=4)', '(NSRange) ns_range = location=4, length=4', '(NSRect *) ns_rect_ptr = (x=1, y=1), (width=5, height=5)', '(NSRect) ns_rect = (x=1, y=1), (width=5, height=5)', '(NSRectArray) ns_rect_arr = ((x=1, y=1), (width=5, height=5)), ...', - '(NSSize) ns_size = width=5, height=7', - '(NSSize *) ns_size_ptr = width=5, height=7', + '(NSSize) ns_size = (width=5, height=7)', + '(NSSize *) ns_size_ptr = (width=5, height=7)', '(CGSize) cg_size = (width=1, height=6)', '(CGPoint) cg_point = (x=2, y=7)', '(CGRect) cg_rect = origin=(x=1, y=2) size=(width=7, height=7)', 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 20c41229e55..12d4650ae57 100644 --- a/lldb/test/functionalities/data-formatter/data-formatter-objc/main.m +++ b/lldb/test/functionalities/data-formatter/data-formatter-objc/main.m @@ -517,6 +517,41 @@ int main (int argc, const char * argv[]) NSURL *nsurl2 = [NSURL URLWithString:@"page.html" relativeToURL:nsurl]; NSURL *nsurl3 = [NSURL URLWithString:@"?whatever" relativeToURL:nsurl2]; + NSDate *date1 = [NSDate dateWithNaturalLanguageString:@"6pm April 10, 1985"]; + NSDate *date2 = [NSDate dateWithNaturalLanguageString:@"12am January 1, 2011"]; + NSDate *date3 = [NSDate date]; + NSDate *date4 = [NSDate dateWithTimeIntervalSince1970:24*60*60]; + + CFAbsoluteTime date1_abs = CFDateGetAbsoluteTime(date1); + CFAbsoluteTime date2_abs = CFDateGetAbsoluteTime(date2); + CFAbsoluteTime date3_abs = CFDateGetAbsoluteTime(date3); + CFAbsoluteTime date4_abs = CFDateGetAbsoluteTime(date4); + + NSCountedSet *nscounted_set = [[NSCountedSet alloc] initWithCapacity:5]; + + [nscounted_set addObject:str0]; + [nscounted_set addObject:str1]; + [nscounted_set addObject:str0]; + [nscounted_set addObject:str0]; + [nscounted_set addObject:@"foo1"]; + [nscounted_set addObject:@"foo2"]; + [nscounted_set addObject:@"foo3"]; + + NSIndexSet *iset1 = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(1, 4)]; + NSIndexSet *iset2 = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(1, 512)]; + + NSMutableIndexSet *imset = [[NSMutableIndexSet alloc] init]; + [imset addIndex:4]; + [imset addIndex:7]; + [imset addIndex:9]; + [imset addIndex:11]; + [imset addIndex:24]; + [imset addIndex:41]; + [imset addIndex:58]; + [imset addIndex:61]; + [imset addIndex:62]; + [imset addIndex:63]; + CFGregorianUnits cf_greg_units = {1,3,5,12,5,7}; CFRange cf_range = {4,4}; NSPoint ns_point = {4,4}; |