2 Test lldb data formatter subsystem.
5 from __future__ import print_function
11 from lldbsuite.test.decorators import *
12 from lldbsuite.test.lldbtest import *
13 from lldbsuite.test import lldbutil
16 class DataFormatterSynthTypeTestCase(TestBase):
18 mydir = TestBase.compute_mydir(__file__)
21 # Call super's setUp().
23 # Find the line number to break at.
24 self.line = line_number('main.cpp', 'break here')
26 @skipIfFreeBSD # llvm.org/pr20545 bogus output confuses buildbot parser
27 def test_with_run_command(self):
28 """Test using Python synthetic children provider to provide a typename."""
30 self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
32 lldbutil.run_break_set_by_file_and_line(
33 self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
35 self.runCmd("run", RUN_SUCCEEDED)
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)
50 # Execute the cleanup function during test case tear down.
51 self.addTearDownHook(cleanup)
53 self.runCmd("script from myIntSynthProvider import *")
54 self.runCmd("type synth add -l myIntSynthProvider myInt")
56 self.expect('frame variable x', substrs=['ThisTestPasses'])
57 self.expect('frame variable y', substrs=['ThisTestPasses'])
58 self.expect('frame variable z', substrs=['ThisTestPasses'])