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 LibcxxIteratorDataFormatterTestCase(TestBase):
16 mydir = TestBase.compute_mydir(__file__)
19 # Call super's setUp().
21 # Find the line number to break at.
22 self.line = line_number('main.cpp', '// Set break point at this line.')
25 @skipIfWindows # libc++ not ported to Windows yet
26 def test_with_run_command(self):
27 """Test that libc++ iterators format properly."""
29 self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
31 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
33 self.runCmd("run", RUN_SUCCEEDED)
35 lldbutil.skip_if_library_missing(self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
37 # The stop reason of the thread should be breakpoint.
38 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
40 'stop reason = breakpoint'])
42 # This is the function to remove the custom formats in order to have a
43 # clean slate for the next test case.
45 self.runCmd('type format clear', check=False)
46 self.runCmd('type summary clear', check=False)
47 self.runCmd('type filter clear', check=False)
48 self.runCmd('type synth clear', check=False)
49 self.runCmd("settings set target.max-children-count 256", check=False)
51 # Execute the cleanup function during test case tear down.
52 self.addTearDownHook(cleanup)
54 self.expect('image list', substrs = self.getLibcPlusPlusLibs())
56 self.expect('frame variable ivI', substrs = ['item = 3'])
57 self.expect('expr ivI', substrs = ['item = 3'])
59 self.expect('frame variable iimI', substrs = ['first = 0','second = 12'])
60 self.expect('expr iimI', substrs = ['first = 0','second = 12'])
62 self.expect('frame variable simI', substrs = ['first = "world"','second = 42'])
63 self.expect('expr simI', substrs = ['first = "world"','second = 42'])
65 self.expect('frame variable svI', substrs = ['item = "hello"'])
66 self.expect('expr svI', substrs = ['item = "hello"'])