1# encoding: utf-8 2""" 3Test lldb data formatter subsystem. 4""" 5 6 7import lldb 8from lldbsuite.test.decorators import * 9from lldbsuite.test.lldbtest import * 10from lldbsuite.test import lldbutil 11 12from ObjCDataFormatterTestCase import ObjCDataFormatterTestCase 13 14 15class ObjCDataFormatterCF(ObjCDataFormatterTestCase): 16 17 @skipUnlessDarwin 18 def test_coreframeworks_and_run_command(self): 19 """Test formatters for Core OSX frameworks.""" 20 self.build() 21 self.target, process, thread, bkpt = lldbutil.run_to_source_breakpoint( 22 self, '// Set break point at this line.', 23 lldb.SBFileSpec('main.m', False)) 24 25 # The stop reason of the thread should be breakpoint. 26 self.expect( 27 "thread list", 28 STOPPED_DUE_TO_BREAKPOINT, 29 substrs=['stopped', 'stop reason = breakpoint']) 30 31 # check formatters for common Objective-C types 32 expect_strings = [ 33 '(CFGregorianUnits) cf_greg_units = 1 years, 3 months, 5 days, 12 hours, 5 minutes 7 seconds', 34 '(CFGregorianDate) cf_greg_date = @"4/10/1985 18:0:0"', 35 '(CFRange) cf_range = location=4 length=4', 36 '(NSPoint) ns_point = (x = 4, y = 4)', 37 '(NSRange) ns_range = location=4, length=4', 38 '(NSRect) ns_rect = (origin = (x = 1, y = 1), size = (width = 5, height = 5))', 39 '(NSRectArray) ns_rect_arr = ((x = 1, y = 1), (width = 5, height = 5)), ...', 40 '(NSSize) ns_size = (width = 5, height = 7)', 41 '(CGSize) cg_size = (width = 1, height = 6)', 42 '(CGPoint) cg_point = (x = 2, y = 7)', 43 '(CGRect) cg_rect = (origin = (x = 1, y = 2), size = (width = 7, height = 7))', 44 '(Rect) rect = (t=4, l=8, b=4, r=7)', 45 '(Rect *) rect_ptr = (t=4, l=8, b=4, r=7)', 46 '(Point) point = (v=7, h=12)', '(Point *) point_ptr = (v=7, h=12)', 47 '(SEL) foo_selector = "foo_selector_impl"' 48 ] 49 50 self.expect("frame variable", substrs=expect_strings) 51 52 if self.getArchitecture() in ['i386', 'x86_64']: 53 extra_string = [ 54 '(RGBColor) rgb_color = red=3 green=56 blue=35', 55 '(RGBColor *) rgb_color_ptr = red=3 green=56 blue=35', 56 '(HIPoint) hi_point = (x=7, y=12)', 57 '(HIRect) hi_rect = origin=(x = 3, y = 5) size=(width = 4, height = 6)', 58 ] 59 self.expect("frame variable", substrs=extra_string) 60