2 Test lldb data formatter subsystem.
5 from __future__ import print_function
11 from lldbsuite.test.lldbtest import *
12 import lldbsuite.test.lldbutil as lldbutil
14 class LibcxxMultiSetDataFormatterTestCase(TestBase):
16 mydir = TestBase.compute_mydir(__file__)
19 @skipIfWindows # libc++ not ported to Windows yet
20 def test_with_run_command(self):
21 """Test that that file and class static variables display correctly."""
23 self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
25 bkpt = self.target().FindBreakpointByID(lldbutil.run_break_set_by_source_regexp (self, "Set break point at this line."))
27 self.runCmd("run", RUN_SUCCEEDED)
29 lldbutil.skip_if_library_missing(self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
31 # The stop reason of the thread should be breakpoint.
32 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
34 'stop reason = breakpoint'])
36 # This is the function to remove the custom formats in order to have a
37 # clean slate for the next test case.
39 self.runCmd('type format clear', check=False)
40 self.runCmd('type summary clear', check=False)
41 self.runCmd('type filter clear', check=False)
42 self.runCmd('type synth clear', check=False)
43 self.runCmd("settings set target.max-children-count 256", check=False)
45 # Execute the cleanup function during test case tear down.
46 self.addTearDownHook(cleanup)
48 self.expect('image list', substrs = self.getLibcPlusPlusLibs())
50 self.expect("frame variable ii",substrs = ["size=0","{}"])
51 lldbutil.continue_to_breakpoint(self.process(), bkpt)
52 self.expect("frame variable ii",substrs = ["size=6","[0] = 0","[1] = 1", "[2] = 2", "[3] = 3", "[4] = 4", "[5] = 5"])
53 lldbutil.continue_to_breakpoint(self.process(), bkpt)
54 self.expect("frame variable ii",substrs = ["size=7","[2] = 2", "[3] = 3", "[6] = 6"])
55 self.expect("p ii",substrs = ["size=7","[2] = 2", "[3] = 3", "[6] = 6"])
56 self.expect("frame variable ii[2]",substrs = [" = 2"])
57 lldbutil.continue_to_breakpoint(self.process(), bkpt)
58 self.expect("frame variable ii",substrs = ["size=0","{}"])
59 lldbutil.continue_to_breakpoint(self.process(), bkpt)
60 self.expect("frame variable ii",substrs = ["size=0","{}"])
61 self.expect("frame variable ss",substrs = ["size=0","{}"])
62 lldbutil.continue_to_breakpoint(self.process(), bkpt)
63 self.expect("frame variable ss",substrs = ["size=2",'[0] = "a"','[1] = "a very long string is right here"'])
64 lldbutil.continue_to_breakpoint(self.process(), bkpt)
65 self.expect("frame variable ss",substrs = ["size=4",'[2] = "b"','[3] = "c"','[0] = "a"','[1] = "a very long string is right here"'])
66 self.expect("p ss",substrs = ["size=4",'[2] = "b"','[3] = "c"','[0] = "a"','[1] = "a very long string is right here"'])
67 self.expect("frame variable ss[2]",substrs = [' = "b"'])
68 lldbutil.continue_to_breakpoint(self.process(), bkpt)
69 self.expect("frame variable ss",substrs = ["size=3",'[0] = "a"','[1] = "a very long string is right here"','[2] = "c"'])