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