aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-02 19:26:05 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-02 19:26:05 +0000
commit14f1b3e8826ce43b978db93a62d1166055db5394 (patch)
tree0a00ad8d3498783fe0193f3b656bca17c4c8697d /packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc
parent4ee8c119c71a06dcad1e0fecc8c675e480e59337 (diff)
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc')
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py373
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/TestDataFormatterNSIndexPath.py115
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/main.m31
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py91
6 files changed, 426 insertions, 195 deletions
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
index d7d4118d1d6a..d0a1728b87e6 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
@@ -6,14 +6,15 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
import datetime
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ObjCDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -24,7 +25,7 @@ class ObjCDataFormatterTestCase(TestBase):
self.build()
self.plain_data_formatter_commands()
- def appkit_tester_impl(self,commands):
+ def appkit_tester_impl(self, commands):
self.build()
self.appkit_common_data_formatters_command()
commands()
@@ -49,25 +50,21 @@ class ObjCDataFormatterTestCase(TestBase):
"""Test formatters for NSURL."""
self.appkit_tester_impl(self.nsurl_data_formatter_commands)
-
@skipUnlessDarwin
def test_nserror_with_run_command(self):
"""Test formatters for NSError."""
self.appkit_tester_impl(self.nserror_data_formatter_commands)
-
@skipUnlessDarwin
def test_nsbundle_with_run_command(self):
"""Test formatters for NSBundle."""
self.appkit_tester_impl(self.nsbundle_data_formatter_commands)
-
@skipUnlessDarwin
def test_nsexception_with_run_command(self):
"""Test formatters for NSException."""
self.appkit_tester_impl(self.nsexception_data_formatter_commands)
-
@skipUnlessDarwin
def test_nsdate_with_run_command(self):
"""Test formatters for NSDate."""
@@ -101,14 +98,15 @@ class ObjCDataFormatterTestCase(TestBase):
"""Test basic ObjC formatting behavior."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
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'])
+ 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.
@@ -123,57 +121,58 @@ class ObjCDataFormatterTestCase(TestBase):
self.runCmd("type summary add --summary-string \"${var%@}\" MyClass")
self.expect("frame variable object2",
- substrs = ['MyOtherClass']);
-
+ substrs=['MyOtherClass'])
+
self.expect("frame variable *object2",
- substrs = ['MyOtherClass']);
+ substrs=['MyOtherClass'])
# Now let's delete the 'MyClass' custom summary.
self.runCmd("type summary delete MyClass")
# The type format list should not show 'MyClass' at this point.
self.expect("type summary list", matching=False,
- substrs = ['MyClass'])
+ substrs=['MyClass'])
self.runCmd("type summary add --summary-string \"a test\" MyClass")
-
+
self.expect("frame variable *object2",
- substrs = ['*object2 =',
- 'MyClass = a test',
- 'backup = ']);
-
+ substrs=['*object2 =',
+ 'MyClass = a test',
+ 'backup = '])
+
self.expect("frame variable object2", matching=False,
- substrs = ['a test']);
-
+ substrs=['a test'])
+
self.expect("frame variable object",
- substrs = ['a test']);
-
+ substrs=['a test'])
+
self.expect("frame variable *object",
- substrs = ['a test']);
+ substrs=['a test'])
self.expect('frame variable myclass',
- substrs = ['(Class) myclass = NSValue'])
+ substrs=['(Class) myclass = NSValue'])
self.expect('frame variable myclass2',
- substrs = ['(Class) myclass2 = ','NS','String'])
+ substrs=['(Class) myclass2 = ', 'NS', 'String'])
self.expect('frame variable myclass3',
- substrs = ['(Class) myclass3 = Molecule'])
+ substrs=['(Class) myclass3 = Molecule'])
self.expect('frame variable myclass4',
- substrs = ['(Class) myclass4 = NSMutableArray'])
+ substrs=['(Class) myclass4 = NSMutableArray'])
self.expect('frame variable myclass5',
- substrs = ['(Class) myclass5 = nil'])
+ substrs=['(Class) myclass5 = nil'])
def appkit_common_data_formatters_command(self):
"""Test formatters for AppKit classes."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
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'])
+ 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.
@@ -184,132 +183,183 @@ class ObjCDataFormatterTestCase(TestBase):
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
-
+
def nsnumber_data_formatter_commands(self):
# Now enable AppKit and check we are displaying Cocoa classes correctly
self.expect('frame variable num1 num2 num3 num4 num5 num6 num7 num9',
- substrs = ['(NSNumber *) num1 = ',' (int)5',
- '(NSNumber *) num2 = ',' (float)3.1',
- '(NSNumber *) num3 = ',' (double)3.14',
- '(NSNumber *) num4 = ',' (long)-2',
- '(NSNumber *) num5 = ',' (char)65',
- '(NSNumber *) num6 = ',' (long)255',
- '(NSNumber *) num7 = ','2000000',
- '(NSNumber *) num9 = ',' (short)-31616'])
+ substrs=['(NSNumber *) num1 = ', ' (int)5',
+ '(NSNumber *) num2 = ', ' (float)3.1',
+ '(NSNumber *) num3 = ', ' (double)3.14',
+ '(NSNumber *) num4 = ', ' (long)-2',
+ '(NSNumber *) num5 = ', ' (char)65',
+ '(NSNumber *) num6 = ', ' (long)255',
+ '(NSNumber *) num7 = ', '2000000',
+ '(NSNumber *) num9 = ', ' (short)-31616'])
self.expect('frame variable num_at1 num_at2 num_at3 num_at4',
- substrs = ['(NSNumber *) num_at1 = ',' (int)12',
- '(NSNumber *) num_at2 = ',' (int)-12',
- '(NSNumber *) num_at3 = ',' (double)12.5',
- '(NSNumber *) num_at4 = ',' (double)-12.5'])
+ substrs=['(NSNumber *) num_at1 = ', ' (int)12',
+ '(NSNumber *) num_at2 = ', ' (int)-12',
+ '(NSNumber *) num_at3 = ', ' (double)12.5',
+ '(NSNumber *) num_at4 = ', ' (double)-12.5'])
def nscontainers_data_formatter_commands(self):
- self.expect('frame variable newArray newDictionary newMutableDictionary cfarray_ref mutable_array_ref',
- substrs = ['(NSArray *) newArray = ','@"50 elements"',
- '(NSDictionary *) newDictionary = ',' 12 key/value pairs',
- '(NSDictionary *) newMutableDictionary = ',' 21 key/value pairs',
- '(CFArrayRef) cfarray_ref = ','@"3 elements"',
- '(CFMutableArrayRef) mutable_array_ref = ','@"11 elements"'])
+ self.expect(
+ 'frame variable newArray newDictionary newMutableDictionary cfarray_ref mutable_array_ref',
+ substrs=[
+ '(NSArray *) newArray = ',
+ '@"50 elements"',
+ '(NSDictionary *) newDictionary = ',
+ ' 12 key/value pairs',
+ '(NSDictionary *) newMutableDictionary = ',
+ ' 21 key/value pairs',
+ '(CFArrayRef) cfarray_ref = ',
+ '@"3 elements"',
+ '(CFMutableArrayRef) mutable_array_ref = ',
+ '@"11 elements"'])
self.expect('frame variable iset1 iset2 imset',
- substrs = ['4 indexes','512 indexes','10 indexes'])
+ substrs=['4 indexes', '512 indexes', '10 indexes'])
- self.expect('frame variable binheap_ref',
- substrs = ['(CFBinaryHeapRef) binheap_ref = ','@"21 items"'])
+ self.expect(
+ 'frame variable binheap_ref',
+ substrs=[
+ '(CFBinaryHeapRef) binheap_ref = ',
+ '@"21 items"'])
- self.expect('expression -d run -- [NSArray new]', substrs=['@"0 elements"'])
+ self.expect(
+ 'expression -d run -- (NSArray*)[NSArray new]',
+ substrs=['@"0 elements"'])
def nsdata_data_formatter_commands(self):
- self.expect('frame variable immutableData mutableData data_ref mutable_data_ref mutable_string_ref',
- substrs = ['(NSData *) immutableData = ',' 4 bytes',
- '(NSData *) mutableData = ',' 14 bytes',
- '(CFDataRef) data_ref = ','@"5 bytes"',
- '(CFMutableDataRef) mutable_data_ref = ','@"5 bytes"',
- '(CFMutableStringRef) mutable_string_ref = ',' @"Wish ya knew"'])
+ self.expect(
+ 'frame variable immutableData mutableData data_ref mutable_data_ref mutable_string_ref',
+ substrs=[
+ '(NSData *) immutableData = ',
+ ' 4 bytes',
+ '(NSData *) mutableData = ',
+ ' 14 bytes',
+ '(CFDataRef) data_ref = ',
+ '@"5 bytes"',
+ '(CFMutableDataRef) mutable_data_ref = ',
+ '@"5 bytes"',
+ '(CFMutableStringRef) mutable_string_ref = ',
+ ' @"Wish ya knew"'])
def nsurl_data_formatter_commands(self):
- self.expect('frame variable cfurl_ref cfchildurl_ref cfgchildurl_ref',
- substrs = ['(CFURLRef) cfurl_ref = ','@"http://www.foo.bar',
- 'cfchildurl_ref = ','@"page.html -- http://www.foo.bar',
- '(CFURLRef) cfgchildurl_ref = ','@"?whatever -- http://www.foo.bar/page.html"'])
-
- self.expect('frame variable nsurl nsurl2 nsurl3',
- substrs = ['(NSURL *) nsurl = ','@"http://www.foo.bar',
- '(NSURL *) nsurl2 =','@"page.html -- http://www.foo.bar',
- '(NSURL *) nsurl3 = ','@"?whatever -- http://www.foo.bar/page.html"'])
+ self.expect(
+ 'frame variable cfurl_ref cfchildurl_ref cfgchildurl_ref',
+ substrs=[
+ '(CFURLRef) cfurl_ref = ',
+ '@"http://www.foo.bar',
+ 'cfchildurl_ref = ',
+ '@"page.html -- http://www.foo.bar',
+ '(CFURLRef) cfgchildurl_ref = ',
+ '@"?whatever -- http://www.foo.bar/page.html"'])
+
+ self.expect(
+ 'frame variable nsurl nsurl2 nsurl3',
+ substrs=[
+ '(NSURL *) nsurl = ',
+ '@"http://www.foo.bar',
+ '(NSURL *) nsurl2 =',
+ '@"page.html -- http://www.foo.bar',
+ '(NSURL *) nsurl3 = ',
+ '@"?whatever -- http://www.foo.bar/page.html"'])
def nserror_data_formatter_commands(self):
self.expect('frame variable nserror',
- substrs = ['domain: @"Foobar" - code: 12'])
+ substrs=['domain: @"Foobar" - code: 12'])
self.expect('frame variable nserrorptr',
- substrs = ['domain: @"Foobar" - code: 12'])
+ substrs=['domain: @"Foobar" - code: 12'])
self.expect('frame variable nserror->_userInfo',
- substrs = ['2 key/value pairs'])
+ substrs=['2 key/value pairs'])
- self.expect('frame variable nserror->_userInfo --ptr-depth 1 -d run-target',
- substrs = ['@"a"','@"b"',"1","2"])
+ self.expect(
+ 'frame variable nserror->_userInfo --ptr-depth 1 -d run-target',
+ substrs=[
+ '@"a"',
+ '@"b"',
+ "1",
+ "2"])
def nsbundle_data_formatter_commands(self):
- self.expect('frame variable bundle_string bundle_url main_bundle',
- substrs = ['(NSBundle *) bundle_string = ',' @"/System/Library/Frameworks/Accelerate.framework"',
- '(NSBundle *) bundle_url = ',' @"/System/Library/Frameworks/Cocoa.framework"',
- '(NSBundle *) main_bundle = ','data-formatter-objc'])
+ self.expect(
+ 'frame variable bundle_string bundle_url main_bundle',
+ substrs=[
+ '(NSBundle *) bundle_string = ',
+ ' @"/System/Library/Frameworks/Accelerate.framework"',
+ '(NSBundle *) bundle_url = ',
+ ' @"/System/Library/Frameworks/Foundation.framework"',
+ '(NSBundle *) main_bundle = ',
+ 'data-formatter-objc'])
def nsexception_data_formatter_commands(self):
- self.expect('frame variable except0 except1 except2 except3',
- substrs = ['(NSException *) except0 = ','name: @"TheGuyWhoHasNoName" - reason: @"cuz it\'s funny"',
- '(NSException *) except1 = ','name: @"TheGuyWhoHasNoName~1" - reason: @"cuz it\'s funny"',
- '(NSException *) except2 = ','name: @"TheGuyWhoHasNoName`2" - reason: @"cuz it\'s funny"',
- '(NSException *) except3 = ','name: @"TheGuyWhoHasNoName/3" - reason: @"cuz it\'s funny"'])
+ self.expect(
+ 'frame variable except0 except1 except2 except3',
+ substrs=[
+ '(NSException *) except0 = ',
+ 'name: @"TheGuyWhoHasNoName" - reason: @"cuz it\'s funny"',
+ '(NSException *) except1 = ',
+ 'name: @"TheGuyWhoHasNoName~1" - reason: @"cuz it\'s funny"',
+ '(NSException *) except2 = ',
+ 'name: @"TheGuyWhoHasNoName`2" - reason: @"cuz it\'s funny"',
+ '(NSException *) except3 = ',
+ 'name: @"TheGuyWhoHasNoName/3" - reason: @"cuz it\'s funny"'])
def nsdate_data_formatter_commands(self):
- self.expect('frame variable date1 date2',
- patterns = ['(1985-04-10|1985-04-11)','(2011-01-01|2010-12-31)'])
+ self.expect(
+ 'frame variable date1 date2',
+ patterns=[
+ '(1985-04-10|1985-04-11)',
+ '(2011-01-01|2010-12-31)'])
# 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 = '%s-' % str(datetime.datetime.now().year)
- self.expect('frame variable date3', substrs = [now_year])
- self.expect('frame variable date4', substrs = ['1970'])
- self.expect('frame variable date5', substrs = [now_year])
+ self.expect('frame variable date3', substrs=[now_year])
+ self.expect('frame variable date4', substrs=['1970'])
+ self.expect('frame variable date5', substrs=[now_year])
self.expect('frame variable date1_abs date2_abs',
- substrs = ['1985-04','2011-01'])
+ substrs=['1985-04', '2011-01'])
- self.expect('frame variable date3_abs', substrs = [now_year])
- self.expect('frame variable date4_abs', substrs = ['1970'])
- self.expect('frame variable date5_abs', substrs = [now_year])
+ self.expect('frame variable date3_abs', substrs=[now_year])
+ self.expect('frame variable date4_abs', substrs=['1970'])
+ self.expect('frame variable date5_abs', substrs=[now_year])
self.expect('frame variable cupertino home europe',
- substrs = ['@"America/Los_Angeles"',
- '@"Europe/Rome"',
- '@"Europe/Paris"'])
+ substrs=['@"America/Los_Angeles"',
+ '@"Europe/Rome"',
+ '@"Europe/Paris"'])
self.expect('frame variable cupertino_ns home_ns europe_ns',
- substrs = ['@"America/Los_Angeles"',
- '@"Europe/Rome"',
- '@"Europe/Paris"'])
-
- self.expect('frame variable mut_bv',
- substrs = ['(CFMutableBitVectorRef) mut_bv = ', '1110 0110 1011 0000 1101 1010 1000 1111 0011 0101 1101 0001 00'])
+ substrs=['@"America/Los_Angeles"',
+ '@"Europe/Rome"',
+ '@"Europe/Paris"'])
+ self.expect(
+ 'frame variable mut_bv',
+ substrs=[
+ '(CFMutableBitVectorRef) mut_bv = ',
+ '1110 0110 1011 0000 1101 1010 1000 1111 0011 0101 1101 0001 00'])
def expr_objc_data_formatter_commands(self):
"""Test common cases of expression parser <--> formatters interaction."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
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'])
+ 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.
@@ -323,36 +373,41 @@ class ObjCDataFormatterTestCase(TestBase):
# check that the formatters are able to deal safely and correctly
# with ValueObjects that the expression parser returns
- self.expect('expression ((id)@"Hello for long enough to avoid short string types")', matching=False,
- substrs = ['Hello for long enough to avoid short string types'])
+ self.expect(
+ 'expression ((id)@"Hello for long enough to avoid short string types")',
+ matching=False,
+ substrs=['Hello for long enough to avoid short string types'])
- self.expect('expression -d run -- ((id)@"Hello for long enough to avoid short string types")',
- substrs = ['Hello for long enough to avoid short string types'])
+ self.expect(
+ 'expression -d run -- ((id)@"Hello for long enough to avoid short string types")',
+ substrs=['Hello for long enough to avoid short string types'])
self.expect('expr -d run -- label1',
- substrs = ['Process Name'])
-
- self.expect('expr -d run -- @"Hello for long enough to avoid short string types"',
- substrs = ['Hello for long enough to avoid short string types'])
+ substrs=['Process Name'])
- self.expect('expr -d run --object-description -- @"Hello for long enough to avoid short string types"',
- substrs = ['Hello for long enough to avoid short string types'])
- self.expect('expr -d run --object-description -- @"Hello"', matching=False,
- substrs = ['@"Hello" Hello'])
+ self.expect(
+ 'expr -d run -- @"Hello for long enough to avoid short string types"',
+ substrs=['Hello for long enough to avoid short string types'])
+ self.expect(
+ 'expr -d run --object-description -- @"Hello for long enough to avoid short string types"',
+ substrs=['Hello for long enough to avoid short string types'])
+ self.expect('expr -d run --object-description -- @"Hello"',
+ matching=False, substrs=['@"Hello" Hello'])
def cf_data_formatter_commands(self):
"""Test formatters for Core OSX frameworks."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
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'])
+ 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.
@@ -361,50 +416,53 @@ class ObjCDataFormatterTestCase(TestBase):
self.runCmd('type summary clear', check=False)
self.runCmd('type synth clear', check=False)
-
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
# check formatters for common Objective-C types
- expect_strings = ['(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)',
- '(NSRange) ns_range = location=4, length=4',
- '(NSRect) ns_rect = (origin = (x = 1, y = 1), size = (width = 5, height = 5))',
- '(NSRectArray) ns_rect_arr = ((x = 1, y = 1), (width = 5, height = 5)), ...',
- '(NSSize) ns_size = (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))',
- '(Rect) rect = (t=4, l=8, b=4, r=7)',
- '(Rect *) rect_ptr = (t=4, l=8, b=4, r=7)',
- '(Point) point = (v=7, h=12)',
- '(Point *) point_ptr = (v=7, h=12)',
- '1985',
- 'foo_selector_impl'];
-
+ expect_strings = [
+ '(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)',
+ '(NSRange) ns_range = location=4, length=4',
+ '(NSRect) ns_rect = (origin = (x = 1, y = 1), size = (width = 5, height = 5))',
+ '(NSRectArray) ns_rect_arr = ((x = 1, y = 1), (width = 5, height = 5)), ...',
+ '(NSSize) ns_size = (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))',
+ '(Rect) rect = (t=4, l=8, b=4, r=7)',
+ '(Rect *) rect_ptr = (t=4, l=8, b=4, r=7)',
+ '(Point) point = (v=7, h=12)',
+ '(Point *) point_ptr = (v=7, h=12)',
+ '1985',
+ 'foo_selector_impl']
+
if self.getArchitecture() in ['i386', 'x86_64']:
expect_strings.append('(HIPoint) hi_point = (x=7, y=12)')
- expect_strings.append('(HIRect) hi_rect = origin=(x = 3, y = 5) size=(width = 4, height = 6)')
- expect_strings.append('(RGBColor) rgb_color = red=3 green=56 blue=35')
- expect_strings.append('(RGBColor *) rgb_color_ptr = red=3 green=56 blue=35')
-
- self.expect("frame variable",
- substrs = expect_strings)
+ expect_strings.append(
+ '(HIRect) hi_rect = origin=(x = 3, y = 5) size=(width = 4, height = 6)')
+ expect_strings.append(
+ '(RGBColor) rgb_color = red=3 green=56 blue=35')
+ expect_strings.append(
+ '(RGBColor *) rgb_color_ptr = red=3 green=56 blue=35')
+ self.expect("frame variable",
+ substrs=expect_strings)
def kvo_data_formatter_commands(self):
"""Test the behavior of formatters when KVO is in use."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
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'])
+ 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.
@@ -420,18 +478,23 @@ class ObjCDataFormatterTestCase(TestBase):
# we should be able to dynamically figure out that the KVO implementor class
# is a subclass of Molecule, and use the appropriate summary for it
self.runCmd("type summary add -s JustAMoleculeHere Molecule")
- self.expect('frame variable molecule', substrs = ['JustAMoleculeHere'])
+ self.expect('frame variable molecule', substrs=['JustAMoleculeHere'])
self.runCmd("next")
self.expect("thread list",
- substrs = ['stopped',
- 'step over'])
- self.expect('frame variable molecule', substrs = ['JustAMoleculeHere'])
+ substrs=['stopped',
+ 'step over'])
+ self.expect('frame variable molecule', substrs=['JustAMoleculeHere'])
self.runCmd("next")
- # check that NSMutableDictionary's formatter is not confused when dealing with a KVO'd dictionary
- self.expect('frame variable newMutableDictionary', substrs = ['(NSDictionary *) newMutableDictionary = ',' 21 key/value pairs'])
+ # check that NSMutableDictionary's formatter is not confused when
+ # dealing with a KVO'd dictionary
+ self.expect(
+ 'frame variable newMutableDictionary',
+ substrs=[
+ '(NSDictionary *) newMutableDictionary = ',
+ ' 21 key/value pairs'])
- lldbutil.run_break_set_by_regexp (self, 'setAtoms')
+ lldbutil.run_break_set_by_regexp(self, 'setAtoms')
self.runCmd("continue")
- self.expect("frame variable _cmd",substrs = ['setAtoms:'])
+ self.expect("frame variable _cmd", substrs=['setAtoms:'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
index 020e2fc6227a..1543ce6edb91 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
@@ -463,7 +463,7 @@ int main (int argc, const char * argv[])
NSError **nserrorptr = &nserror;
NSBundle* bundle_string = [[NSBundle alloc] initWithPath:@"/System/Library/Frameworks/Accelerate.framework"];
- NSBundle* bundle_url = [[NSBundle alloc] initWithURL:[[NSURL alloc] initWithString:@"file://localhost/System/Library/Frameworks/Cocoa.framework"]];
+ NSBundle* bundle_url = [[NSBundle alloc] initWithURL:[[NSURL alloc] initWithString:@"file://localhost/System/Library/Frameworks/Foundation.framework"]];
NSBundle* main_bundle = [NSBundle mainBundle];
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/Makefile
new file mode 100644
index 000000000000..0d94c2247f14
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+OBJC_SOURCES := main.m
+
+CFLAGS_EXTRAS += -w
+
+include $(LEVEL)/Makefile.rules
+
+LDFLAGS += -framework Foundation
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/TestDataFormatterNSIndexPath.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/TestDataFormatterNSIndexPath.py
new file mode 100644
index 000000000000..2d66a941ed34
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/TestDataFormatterNSIndexPath.py
@@ -0,0 +1,115 @@
+# encoding: utf-8
+"""
+Test lldb data formatter subsystem.
+"""
+
+from __future__ import print_function
+
+
+import os
+import time
+import datetime
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class NSIndexPathDataFormatterTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def appkit_tester_impl(self, commands):
+ self.build()
+ self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+
+ 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)
+
+ # Execute the cleanup function during test case tear down.
+ self.addTearDownHook(cleanup)
+ commands()
+
+ @skipUnlessDarwin
+ @expectedFailureAll(archs=['i386'], bugnumber="rdar://28656605")
+ def test_nsindexpath_with_run_command(self):
+ """Test formatters for NSIndexPath."""
+ self.appkit_tester_impl(self.nsindexpath_data_formatter_commands)
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ # Find the line number to break at.
+ self.line = line_number('main.m', '// break here')
+
+ def nsindexpath_data_formatter_commands(self):
+ # check 'frame variable'
+ self.expect(
+ 'frame variable --ptr-depth=1 -d run -- indexPath1',
+ substrs=['[0] = 1'])
+ self.expect(
+ 'frame variable --ptr-depth=1 -d run -- indexPath2',
+ substrs=[
+ '[0] = 1',
+ '[1] = 2'])
+ self.expect(
+ 'frame variable --ptr-depth=1 -d run -- indexPath3',
+ substrs=[
+ '[0] = 1',
+ '[1] = 2',
+ '[2] = 3'])
+ self.expect(
+ 'frame variable --ptr-depth=1 -d run -- indexPath4',
+ substrs=[
+ '[0] = 1',
+ '[1] = 2',
+ '[2] = 3',
+ '[3] = 4'])
+ self.expect(
+ 'frame variable --ptr-depth=1 -d run -- indexPath5',
+ substrs=[
+ '[0] = 1',
+ '[1] = 2',
+ '[2] = 3',
+ '[3] = 4',
+ '[4] = 5'])
+
+ # and 'expression'
+ self.expect(
+ 'expression --ptr-depth=1 -d run -- indexPath1',
+ substrs=['[0] = 1'])
+ self.expect(
+ 'expression --ptr-depth=1 -d run -- indexPath2',
+ substrs=[
+ '[0] = 1',
+ '[1] = 2'])
+ self.expect(
+ 'expression --ptr-depth=1 -d run -- indexPath3',
+ substrs=[
+ '[0] = 1',
+ '[1] = 2',
+ '[2] = 3'])
+ self.expect('expression --ptr-depth=1 -d run -- indexPath4',
+ substrs=['[0] = 1', '[1] = 2', '[2] = 3', '[3] = 4'])
+ self.expect(
+ 'expression --ptr-depth=1 -d run -- indexPath5',
+ substrs=[
+ '[0] = 1',
+ '[1] = 2',
+ '[2] = 3',
+ '[3] = 4',
+ '[4] = 5'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/main.m b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/main.m
new file mode 100644
index 000000000000..baaff180e34e
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/main.m
@@ -0,0 +1,31 @@
+//===-- main.m ------------------------------------------------*- ObjC -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#import <Foundation/Foundation.h>
+
+int main(int argc, const char **argv)
+{
+ @autoreleasepool
+ {
+ const NSUInteger values[] = { 1, 2, 3, 4, 5 };
+
+ NSIndexPath* indexPath1 = [NSIndexPath indexPathWithIndexes:values length:1];
+ NSIndexPath* indexPath2 = [NSIndexPath indexPathWithIndexes:values length:2];
+ NSIndexPath* indexPath3 = [NSIndexPath indexPathWithIndexes:values length:3];
+ NSIndexPath* indexPath4 = [NSIndexPath indexPathWithIndexes:values length:4];
+ NSIndexPath* indexPath5 = [NSIndexPath indexPathWithIndexes:values length:5];
+
+ NSLog(@"%@", indexPath1); // break here
+ NSLog(@"%@", indexPath2);
+ NSLog(@"%@", indexPath3);
+ NSLog(@"%@", indexPath4);
+ NSLog(@"%@", indexPath5);
+ }
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py
index f5c792593772..12e62f62ee97 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py
@@ -6,30 +6,32 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import datetime
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class NSStringDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- def appkit_tester_impl(self,commands):
+ def appkit_tester_impl(self, commands):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
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'])
+ 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.
@@ -38,7 +40,6 @@ class NSStringDataFormatterTestCase(TestBase):
self.runCmd('type summary clear', check=False)
self.runCmd('type synth clear', check=False)
-
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
commands()
@@ -58,7 +59,6 @@ class NSStringDataFormatterTestCase(TestBase):
"""Test formatters for NSString."""
self.appkit_tester_impl(self.nsstring_withNULs_commands)
-
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
@@ -67,42 +67,55 @@ class NSStringDataFormatterTestCase(TestBase):
def rdar11106605_commands(self):
"""Check that Unicode characters come out of CFString summary correctly."""
- 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 = ['色は匂へど散りぬるを'])
- self.expect('frame variable hebrew', substrs = ['לילה טוב'])
+ 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=['色は匂へど散りぬるを'])
+ self.expect('frame variable hebrew', substrs=['לילה טוב'])
def nsstring_data_formatter_commands(self):
self.expect('frame variable str0 str1 str2 str3 str4 str5 str6 str8 str9 str10 str11 label1 label2 processName str12',
- substrs = ['(NSString *) str1 = ',' @"A rather short ASCII NSString object is here"',
- # '(NSString *) str0 = ',' @"255"',
- '(NSString *) str1 = ',' @"A rather short ASCII NSString object is here"',
- '(NSString *) str2 = ',' @"A rather short UTF8 NSString object is here"',
- '(NSString *) str3 = ',' @"A string made with the at sign is here"',
- '(NSString *) str4 = ',' @"This is string number 4 right here"',
- '(NSString *) str5 = ',' @"{{1, 1}, {5, 5}}"',
- '(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 σ number 4 right here"',
- '(NSString *) str11 = ',' @"__NSCFString"',
- '(NSString *) label1 = ',' @"Process Name: "',
- '(NSString *) label2 = ',' @"Process Id: "',
- '(NSString *) str12 = ',' @"Process Name: a.out Process Id:'])
- self.expect('frame variable attrString mutableAttrString mutableGetConst',
- substrs = ['(NSAttributedString *) attrString = ',' @"hello world from foo"',
- '(NSAttributedString *) mutableAttrString = ',' @"hello world from foo"',
- '(NSString *) mutableGetConst = ',' @"foo said this string needs to be very long so much longer than whatever other string has been seen ever before by anyone of the mankind that of course this is still not long enough given what foo our friend foo our lovely dearly friend foo desired of us so i am adding more stuff here for the sake of it and for the joy of our friend who is named guess what just foo. hence, dear friend foo, stay safe, your string is now long enough to accommodate your testing need and I will make sure that if not we extend it with even more fuzzy random meaningless words pasted one after the other from a long tiresome friday evening spent working in my office. my office mate went home but I am still randomly typing just for the fun of seeing what happens of the length of a Mutable String in Cocoa if it goes beyond one byte.. so be it, dear foo"'])
-
- self.expect('expr -d run-target -- path',substrs = ['usr/blah/stuff'])
- self.expect('frame variable path',substrs = ['usr/blah/stuff'])
+ substrs=['(NSString *) str1 = ', ' @"A rather short ASCII NSString object is here"',
+ # '(NSString *) str0 = ',' @"255"',
+ '(NSString *) str1 = ', ' @"A rather short ASCII NSString object is here"',
+ '(NSString *) str2 = ', ' @"A rather short UTF8 NSString object is here"',
+ '(NSString *) str3 = ', ' @"A string made with the at sign is here"',
+ '(NSString *) str4 = ', ' @"This is string number 4 right here"',
+ '(NSString *) str5 = ', ' @"{{1, 1}, {5, 5}}"',
+ '(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 σ number 4 right here"',
+ '(NSString *) str11 = ', ' @"__NSCFString"',
+ '(NSString *) label1 = ', ' @"Process Name: "',
+ '(NSString *) label2 = ', ' @"Process Id: "',
+ '(NSString *) str12 = ', ' @"Process Name: a.out Process Id:'])
+ self.expect(
+ 'frame variable attrString mutableAttrString mutableGetConst',
+ substrs=[
+ '(NSAttributedString *) attrString = ',
+ ' @"hello world from foo"',
+ '(NSAttributedString *) mutableAttrString = ',
+ ' @"hello world from foo"',
+ '(NSString *) mutableGetConst = ',
+ ' @"foo said this string needs to be very long so much longer than whatever other string has been seen ever before by anyone of the mankind that of course this is still not long enough given what foo our friend foo our lovely dearly friend foo desired of us so i am adding more stuff here for the sake of it and for the joy of our friend who is named guess what just foo. hence, dear friend foo, stay safe, your string is now long enough to accommodate your testing need and I will make sure that if not we extend it with even more fuzzy random meaningless words pasted one after the other from a long tiresome friday evening spent working in my office. my office mate went home but I am still randomly typing just for the fun of seeing what happens of the length of a Mutable String in Cocoa if it goes beyond one byte.. so be it, dear foo"'])
+
+ self.expect('expr -d run-target -- path', substrs=['usr/blah/stuff'])
+ self.expect('frame variable path', substrs=['usr/blah/stuff'])
def nsstring_withNULs_commands(self):
"""Check that the NSString formatter supports embedded NULs in the text"""
- self.expect('po strwithNULs', substrs=['a very much boring task to write'])
+ self.expect(
+ 'po strwithNULs',
+ substrs=['a very much boring task to write'])
self.expect('expr [strwithNULs length]', substrs=['54'])
- self.expect('frame variable strwithNULs', substrs=['@"a very much boring task to write\\0a string this way!!'])
- self.expect('po strwithNULs2', substrs=['a very much boring task to write'])
+ self.expect('frame variable strwithNULs', substrs=[
+ '@"a very much boring task to write\\0a string this way!!'])
+ self.expect('po strwithNULs2', substrs=[
+ 'a very much boring task to write'])
self.expect('expr [strwithNULs2 length]', substrs=['52'])
- self.expect('frame variable strwithNULs2', substrs=['@"a very much boring task to write\\0a string this way!!'])
+ self.expect('frame variable strwithNULs2', substrs=[
+ '@"a very much boring task to write\\0a string this way!!'])