[Lldb-commits] [lldb] r156793 - in /lldb/trunk: examples/summaries/cocoa/CFString.py test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py test/functionalities/data-formatter/data-formatter-objc/main.m
Enrico Granata
egranata at apple.com
Mon May 14 18:22:45 PDT 2012
Author: enrico
Date: Mon May 14 20:22:45 2012
New Revision: 156793
URL: http://llvm.org/viewvc/llvm-project?rev=156793&view=rev
Log:
Fixing a bug where the summary for certain NSStrings was being returned as empty in spite of the string actually having a content
Modified:
lldb/trunk/examples/summaries/cocoa/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/summaries/cocoa/CFString.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/CFString.py?rev=156793&r1=156792&r2=156793&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/CFString.py (original)
+++ lldb/trunk/examples/summaries/cocoa/CFString.py Mon May 14 20:22:45 2012
@@ -65,14 +65,14 @@
return 0;
return 6;
- def read_unicode(self, pointer):
+ def read_unicode(self, pointer,max_len=2048):
logger = lldb.formatters.Logger.Logger()
process = self.valobj.GetTarget().GetProcess()
error = lldb.SBError()
pystr = u''
# cannot do the read at once because the length value has
# a weird encoding. better play it safe here
- while True:
+ while max_len > 0:
content = process.ReadMemory(pointer, 2, error)
new_bytes = bytearray(content)
b0 = new_bytes[0]
@@ -89,6 +89,8 @@
else:
value = b0 * 256 + b1
pystr = pystr + unichr(value)
+ # read max_len unicode values, not max_len bytes
+ max_len = max_len - 1
return pystr
# handle the special case strings
@@ -150,8 +152,11 @@
data = self.valobj.CreateChildAtOffset("content",
offset, self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar).GetPointerType());
data_value = data.GetValueAsUnsigned(0)
- data_value = data_value + 1
- return self.valobj.CreateValueFromExpression("content", "(char*)(" + str(data_value) + ")")
+ if self.explicit and self.unicode:
+ return self.read_unicode(data_value).encode('utf-8')
+ else:
+ data_value = data_value + 1
+ return self.valobj.CreateValueFromExpression("content", "(char*)(" + str(data_value) + ")")
def handle_UTF8_inline(self):
logger = lldb.formatters.Logger.Logger()
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=156793&r1=156792&r2=156793&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 Mon May 14 20:22:45 2012
@@ -136,6 +136,8 @@
self.expect('frame variable french', substrs = ['Que veut cette horde d\'esclaves, De traîtres, de rois conjurés?'])
self.expect('frame variable german', substrs = ['Ãber-Ich und aus den Ansprüchen der sozialen Umwelt'])
self.expect('frame variable japanese', substrs = ['è²ã¯åã¸ã©æ£ãã¬ãã'])
+ self.expect('frame variable hebrew', substrs = ['×××× ×××'])
+
def plain_data_formatter_commands(self):
"""Test basic ObjC formatting behavior."""
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=156793&r1=156792&r2=156793&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 Mon May 14 20:22:45 2012
@@ -285,6 +285,8 @@
NSString* german = @"Ãber-Ich und aus den Ansprüchen der sozialen Umwelt";
void* data_set[3] = {str1,str2,str3};
+
+ NSString *hebrew = [NSString stringWithString:@"×××× ×××"];
NSArray* newArray = [[NSMutableArray alloc] init];
[newArray addObject:str1];
More information about the lldb-commits
mailing list