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