diff options
author | Enrico Granata <granata.enrico@gmail.com> | 2011-07-29 23:59:08 +0000 |
---|---|---|
committer | Enrico Granata <granata.enrico@gmail.com> | 2011-07-29 23:59:08 +0000 |
commit | 3bcee02643609e036108151ff8ac5fadb58ef99f (patch) | |
tree | d05340e32e88ce99c48f444ce83f5c431c12265f /lldb/test | |
parent | 68b23116cbbc5e5952190e935d51cf1002846898 (diff) | |
download | bcm5719-llvm-3bcee02643609e036108151ff8ac5fadb58ef99f.tar.gz bcm5719-llvm-3bcee02643609e036108151ff8ac5fadb58ef99f.zip |
changes in the new GetMinimumLanguages() ; robustness improvements in the CFStringSynthProvider object ; made a CFString_SummaryProvider function you can use if all you care about is the summary string for your NSString objects
llvm-svn: 136544
Diffstat (limited to 'lldb/test')
3 files changed, 33 insertions, 17 deletions
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-objc/CFString.py b/lldb/test/functionalities/data-formatter/data-formatter-objc/CFString.py index bf82c1ddde3..0e39b73ae57 100644 --- a/lldb/test/functionalities/data-formatter/data-formatter-objc/CFString.py +++ b/lldb/test/functionalities/data-formatter/data-formatter-objc/CFString.py @@ -7,6 +7,8 @@ class CFStringSynthProvider: self.update() # children other than "content" are for debugging only and must not be used in production code def num_children(self): + if self.invalid: + return 0; return 6; def read_unicode(self, pointer): process = self.valobj.GetTarget().GetProcess() @@ -167,7 +169,12 @@ class CFStringSynthProvider: self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar)); cfinfo.SetFormat(11) info = cfinfo.GetValue(); - return int(info,0); + if info != None: + self.invalid = False; + return int(info,0); + else: + self.invalid = True; + return None; # calculating internal flag bits of the CFString object # this stuff is defined and discussed in CFString.c def is_mutable(self): @@ -196,6 +203,8 @@ class CFStringSynthProvider: # useful values to get at the real data def compute_flags(self): self.info_bits = self.read_info_bits(); + if self.info_bits == None: + return; self.mutable = self.is_mutable(); self.inline = self.is_inline(); self.explicit = self.has_explicit_length(); @@ -204,3 +213,9 @@ class CFStringSynthProvider: def update(self): self.adjust_for_architecture(); self.compute_flags(); +def CFString_SummaryProvider (valobj,dict): + provider = CFStringSynthProvider(valobj,dict); + if provider.invalid == True: + return "<invalid object>"; + return provider.get_child_at_index(provider.get_child_index("content")).GetSummary(); + 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 a180c33e6fe..e17b6fc195b 100644 --- a/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py +++ b/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py @@ -103,99 +103,100 @@ class DataFormatterTestCase(TestBase): self.runCmd("script from CFString import *") self.runCmd("type synth add -l CFStringSynthProvider NSString") - self.expect('frame variable str -P 1', + self.expect('frame variable str -P 1 -Y', substrs = ['mutable =', 'inline = ', 'explicit = ', 'content = ', 'A rather short ASCII NSString object is here']) - self.expect('frame variable str2 -P 1', + self.expect('frame variable str2 -P 1 -Y', substrs = ['mutable =', 'inline = ', 'explicit = ', 'content = ', 'A rather short UTF8 NSString object is here']) - self.expect('frame variable str3 -P 1', + self.expect('frame variable str3 -P 1 -Y', substrs = ['mutable =', 'inline = ', 'explicit = ', 'content = ', 'A string made with the at sign is here']) - self.expect('frame variable str4 -P 1', + self.expect('frame variable str4 -P 1 -Y', substrs = ['mutable =', 'inline = ', 'explicit = ', 'content = ', 'This is string number 4 right here']) - self.expect('frame variable str5 -P 1', + self.expect('frame variable str5 -P 1 -Y', substrs = ['mutable =', 'inline = ', 'explicit = ', 'content = ', '{{1, 1}, {5, 5}}']) - self.expect('frame variable str6 -P 1', + self.expect('frame variable str6 -P 1 -Y', substrs = ['mutable =', 'inline = ', 'explicit = ', 'content = ', '1ST']) - self.expect('frame variable str7 -P 1', + self.expect('frame variable str7 -P 1 -Y', substrs = ['mutable =', 'inline = ', 'explicit = ', 'content = ', '\\xcf\\x83xx']) - self.expect('frame variable str8 -P 1', + self.expect('frame variable str8 -P 1 -Y', substrs = ['mutable =', 'inline = ', 'explicit = ', 'content = ', 'hasVeryLongExtensionThisTime']) - self.expect('frame variable str9 -P 1', + self.expect('frame variable str9 -P 1 -Y', substrs = ['mutable =', 'inline = ', 'explicit = ', 'content = ', 'a very much boring task to write a string this way!!\\xe4\\x8c\\xb3']) - self.expect('frame variable str10 -P 1', + self.expect('frame variable str10 -P 1 -Y', substrs = ['mutable =', 'inline = ', 'explicit = ', 'content = ', 'This is a Unicode string \\xcf\\x83 number 4 right here']) - self.expect('frame variable str11 -P 1', + self.expect('frame variable str11 -P 1 -Y', substrs = ['mutable =', 'inline = ', 'explicit = ', 'content = ', '__NSCFString']) - self.expect('frame variable processName -P 1', + self.expect('frame variable processName -P 1 -Y', substrs = ['mutable =', 'inline = ', 'explicit = ', 'content = ', 'a.out']) - self.expect('frame variable str12 -P 1', + self.expect('frame variable str12 -P 1 -Y', substrs = ['mutable =', 'inline = ', 'explicit = ', 'content = ', 'Process Name: a.out Process Id:']) - # make it a summary - self.runCmd("type summary add -f \"${svar.content}\" NSString") + # delete the synth and set a summary + self.runCmd("type synth delete NSString") + self.runCmd("type summary add -F CFString_SummaryProvider NSString") self.expect('frame variable str', substrs = ['A rather short ASCII NSString object is here']) 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 4749749b953..6b7df5df10b 100644 --- a/lldb/test/functionalities/data-formatter/data-formatter-objc/main.m +++ b/lldb/test/functionalities/data-formatter/data-formatter-objc/main.m @@ -86,7 +86,7 @@ int main (int argc, const char * argv[]) NSString *str4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4]; - NSRect rect = NSMakeRect(1,1,5,5); + NSRect rect = {{1,1},{5,5}}; NSString* str5 = NSStringFromRect(rect); |