summaryrefslogtreecommitdiffstats
path: root/lldb/test/functionalities/data-formatter/data-formatter-objc
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2012-03-29 01:34:34 +0000
committerEnrico Granata <egranata@apple.com>2012-03-29 01:34:34 +0000
commit86ea8d821a90d7d52b5023e4aa367e5265ca16ce (patch)
tree9f8f8cfcdd8ac6805c12866d4ef5135ca0023cb3 /lldb/test/functionalities/data-formatter/data-formatter-objc
parentb474099e6312ab844fc4c6fe4d346845eb04bf59 (diff)
downloadbcm5719-llvm-86ea8d821a90d7d52b5023e4aa367e5265ca16ce.tar.gz
bcm5719-llvm-86ea8d821a90d7d52b5023e4aa367e5265ca16ce.zip
Fixing an issue where Unicode characters in an NSString were printed as escape sequences by the summary provider shipping with LLDB - Added relevant test case code. Bonus points for identifying the source of the quotes :-)
llvm-svn: 153624
Diffstat (limited to 'lldb/test/functionalities/data-formatter/data-formatter-objc')
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py53
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-objc/main.m7
2 files changed, 59 insertions, 1 deletions
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 b2cc5245b00..bb6a5bc3913 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
@@ -1,3 +1,4 @@
+# encoding: utf-8
"""
Test lldb data formatter subsystem.
"""
@@ -61,6 +62,18 @@ class ObjCDataFormatterTestCase(TestBase):
self.kvo_data_formatter_commands()
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_rdar11106605_with_dsym_and_run_command(self):
+ """Check that Unicode characters come out of CFString summary correctly."""
+ self.buildDsym()
+ self.rdar11106605_commands()
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_rdar11106605_with_dwarf_and_run_command(self):
+ """Check that Unicode characters come out of CFString summary correctly."""
+ self.buildDwarf()
+ self.rdar11106605_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."""
@@ -80,6 +93,44 @@ class ObjCDataFormatterTestCase(TestBase):
# Find the line number to break at.
self.line = line_number('main.m', '// Set break point at this line.')
+ def rdar11106605_commands(self):
+ """Check that Unicode characters come out of CFString summary correctly."""
+ 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)
+
+ self.runCmd("type category enable AppKit")
+
+ self.expect('frame variable italian', substrs = ['L\'Italia è una Repubblica democratica, fondata sul lavoro. La sovranità appartiene al popolo, che la esercita nelle forme e nei limiti della Costituzione.'])
+ 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 = ['色は匂へど散りぬるを'])
+
def plain_data_formatter_commands(self):
"""Test basic ObjC formatting behavior."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
@@ -197,7 +248,7 @@ class ObjCDataFormatterTestCase(TestBase):
'(NSString *) str6 = ',' @"1ST"',
'(NSString *) str8 = ',' @"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime',
'(NSString *) str9 = ',' @"a very much boring task to write a string this way!!',
- '(NSString *) str10 = ',' @"This is a Unicode string',
+ '(NSString *) str10 = ',' @"This is a Unicode string σ number 4 right here"',
'(NSString *) str11 = ',' @"__NSCFString"',
'(NSString *) label1 = ',' @"Process Name: "',
'(NSString *) label2 = ',' @"Process Id: "',
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 c6fea2b7ed1..5271c4d528d 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-objc/main.m
+++ b/lldb/test/functionalities/data-formatter/data-formatter-objc/main.m
@@ -277,6 +277,13 @@ int main (int argc, const char * argv[])
NSString *strD12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
+ NSString *eAcute = [NSString stringWithFormat: @"%C", 0x00E9];
+ NSString *randomHaziChar = [NSString stringWithFormat: @"%C", 0x9DC5];
+ NSString *japanese = @"色は匂へど散りぬるを";
+ NSString *italian = @"L'Italia è una Repubblica democratica, fondata sul lavoro. La sovranità appartiene al popolo, che la esercita nelle forme e nei limiti della Costituzione.";
+ NSString* french = @"Que veut cette horde d'esclaves, De traîtres, de rois conjurés?";
+ NSString* german = @"Über-Ich und aus den Ansprüchen der sozialen Umwelt";
+
void* data_set[3] = {str1,str2,str3};
NSArray* newArray = [[NSMutableArray alloc] init];
OpenPOWER on IntegriCloud