[Lldb-commits] [lldb] r136544 - in /lldb/trunk: examples/synthetic/CFString.py source/Symbol/ClangASTType.cpp test/functionalities/data-formatter/data-formatter-objc/CFString.py test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py test/functionalities/data-formatter/data-formatter-objc/main.m
Enrico Granata
granata.enrico at gmail.com
Fri Jul 29 16:59:08 PDT 2011
Author: enrico
Date: Fri Jul 29 18:59:08 2011
New Revision: 136544
URL: http://llvm.org/viewvc/llvm-project?rev=136544&view=rev
Log:
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
Modified:
lldb/trunk/examples/synthetic/CFString.py
lldb/trunk/source/Symbol/ClangASTType.cpp
lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/CFString.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m
Modified: lldb/trunk/examples/synthetic/CFString.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/CFString.py?rev=136544&r1=136543&r2=136544&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/CFString.py (original)
+++ lldb/trunk/examples/synthetic/CFString.py Fri Jul 29 18:59:08 2011
@@ -7,6 +7,8 @@
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 @@
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 @@
# 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 @@
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();
+
Modified: lldb/trunk/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=136544&r1=136543&r2=136544&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTType.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTType.cpp Fri Jul 29 18:59:08 2011
@@ -235,6 +235,8 @@
case clang::BuiltinType::BoundMember:
case clang::BuiltinType::UnknownAny:
break;
+ case clang::Type::Typedef:
+ return GetMinimumLanguage(cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
}
break;
}
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/CFString.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/CFString.py?rev=136544&r1=136543&r2=136544&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/CFString.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/CFString.py Fri Jul 29 18:59:08 2011
@@ -7,6 +7,8 @@
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 @@
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 @@
# 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 @@
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();
+
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py?rev=136544&r1=136543&r2=136544&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py Fri Jul 29 18:59:08 2011
@@ -103,99 +103,100 @@
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'])
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=136544&r1=136543&r2=136544&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 Jul 29 18:59:08 2011
@@ -86,7 +86,7 @@
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);
More information about the lldb-commits
mailing list