1""" 2Test lldb data formatter subsystem. 3""" 4 5 6 7import lldb 8from lldbsuite.test.decorators import * 9from lldbsuite.test.lldbtest import * 10from lldbsuite.test import lldbutil 11 12 13class CompactVectorsFormattingTestCase(TestBase): 14 15 mydir = TestBase.compute_mydir(__file__) 16 17 def setUp(self): 18 # Call super's setUp(). 19 TestBase.setUp(self) 20 # Find the line number to break at. 21 self.line = line_number('main.cpp', '// Set break point at this line.') 22 23 @skipUnlessDarwin 24 def test_with_run_command(self): 25 """Test that that file and class static variables display correctly.""" 26 self.build() 27 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) 28 29 lldbutil.run_break_set_by_file_and_line( 30 self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) 31 32 self.runCmd("run", RUN_SUCCEEDED) 33 34 # The stop reason of the thread should be breakpoint. 35 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, 36 substrs=['stopped', 37 'stop reason = breakpoint']) 38 39 # This is the function to remove the custom formats in order to have a 40 # clean slate for the next test case. 41 def cleanup(): 42 self.runCmd('type summary clear', check=False) 43 44 # Execute the cleanup function during test case tear down. 45 self.addTearDownHook(cleanup) 46 47 self.expect( 48 'frame variable', 49 substrs=[ 50 '(vFloat) valueFL = (1.25, 0, 0.25, 0)', 51 '(vDouble) valueDL = (1.25, 2.25)', 52 '(int16_t[8]) valueI16 = (1, 0, 4, 0, 0, 1, 0, 4)', 53 '(int32_t[4]) valueI32 = (1, 0, 4, 0)', 54 '(vUInt8) valueU8 = (0x01, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)', 55 '(vUInt16) valueU16 = (1, 0, 4, 0, 0, 1, 0, 4)', 56 '(vUInt32) valueU32 = (1, 2, 3, 4)', 57 '(vSInt8) valueS8 = (1, 0, 4, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0)', 58 '(vSInt16) valueS16 = (1, 0, 4, 0, 0, 1, 0, 4)', 59 '(vSInt32) valueS32 = (4, 3, 2, 1)', 60 '(vBool32) valueBool32 = (0, 1, 0, 1)', 61 ]) 62