1""" 2Test lldb data formatter subsystem. 3""" 4 5 6import lldb 7from lldbsuite.test.decorators import * 8from lldbsuite.test.lldbtest import * 9from lldbsuite.test import lldbutil 10 11 12class StdVBoolDataFormatterTestCase(TestBase): 13 def setUp(self): 14 # Call super's setUp(). 15 TestBase.setUp(self) 16 # Find the line number to break at. 17 self.line = line_number("main.cpp", "// Set break point at this line.") 18 19 @add_test_categories(["libstdcxx"]) 20 def test_with_run_command(self): 21 """Test that that file and class static variables display correctly.""" 22 self.build() 23 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) 24 25 lldbutil.run_break_set_by_file_and_line( 26 self, "main.cpp", self.line, num_expected_locations=-1 27 ) 28 29 self.runCmd("run", RUN_SUCCEEDED) 30 31 # The stop reason of the thread should be breakpoint. 32 self.expect( 33 "thread list", 34 STOPPED_DUE_TO_BREAKPOINT, 35 substrs=["stopped", "stop reason = breakpoint"], 36 ) 37 38 # This is the function to remove the custom formats in order to have a 39 # clean slate for the next test case. 40 def cleanup(): 41 self.runCmd("type format clear", check=False) 42 self.runCmd("type summary clear", check=False) 43 self.runCmd("type filter clear", check=False) 44 self.runCmd("type synth clear", check=False) 45 self.runCmd("settings set target.max-children-count 256", check=False) 46 47 # Execute the cleanup function during test case tear down. 48 self.addTearDownHook(cleanup) 49 50 self.expect( 51 "frame variable vBool", 52 substrs=[ 53 "size=49", 54 "[0] = false", 55 "[1] = true", 56 "[18] = false", 57 "[27] = true", 58 "[36] = false", 59 "[47] = true", 60 "[48] = true", 61 ], 62 ) 63 64 self.expect( 65 "expr vBool", 66 substrs=[ 67 "size=49", 68 "[0] = false", 69 "[1] = true", 70 "[18] = false", 71 "[27] = true", 72 "[36] = false", 73 "[47] = true", 74 "[48] = true", 75 ], 76 ) 77