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 StdTupleDataFormatterTestCase(TestBase): 13 @add_test_categories(["libstdcxx"]) 14 @expectedFailureAll(bugnumber="llvm.org/pr50861", compiler="gcc") 15 def test_with_run_command(self): 16 self.build() 17 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) 18 19 lldbutil.run_break_set_by_source_regexp(self, "Set break point at this line.") 20 self.runCmd("run", RUN_SUCCEEDED) 21 22 # The stop reason of the thread should be breakpoint. 23 self.expect( 24 "thread list", 25 STOPPED_DUE_TO_BREAKPOINT, 26 substrs=["stopped", "stop reason = breakpoint"], 27 ) 28 29 frame = self.frame() 30 self.assertTrue(frame.IsValid()) 31 32 self.expect("frame variable ti", substrs=["[0] = 1"]) 33 self.expect("frame variable ts", substrs=['[0] = "foobar"']) 34 self.expect("frame variable tt", substrs=["[0] = 1", '[1] = "baz"', "[2] = 2"]) 35 36 self.assertEqual(1, frame.GetValueForVariablePath("ti[0]").GetValueAsUnsigned()) 37 self.assertFalse(frame.GetValueForVariablePath("ti[1]").IsValid()) 38 39 self.assertEqual( 40 '"foobar"', frame.GetValueForVariablePath("ts[0]").GetSummary() 41 ) 42 self.assertFalse(frame.GetValueForVariablePath("ts[1]").IsValid()) 43 44 self.assertEqual(1, frame.GetValueForVariablePath("tt[0]").GetValueAsUnsigned()) 45 self.assertEqual('"baz"', frame.GetValueForVariablePath("tt[1]").GetSummary()) 46 self.assertEqual(2, frame.GetValueForVariablePath("tt[2]").GetValueAsUnsigned()) 47 self.assertFalse(frame.GetValueForVariablePath("tt[3]").IsValid()) 48