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 TypeSummaryListScriptTestCase(TestBase):
18 mydir = TestBase.compute_mydir(__file__)
20 def test_typesummarylist_script(self):
21 """Test data formatter commands."""
23 self.data_formatter_commands()
26 # Call super's setUp().
28 # Find the line number to break at.
29 self.line = line_number('main.cpp', 'Break here')
31 def data_formatter_commands(self):
32 """Test printing out Python summary formatters."""
33 self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
35 lldbutil.run_break_set_by_file_and_line(
36 self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
38 self.runCmd("run", RUN_SUCCEEDED)
40 # The stop reason of the thread should be breakpoint.
41 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
43 'stop reason = breakpoint'])
45 # This is the function to remove the custom formats in order to have a
46 # clean slate for the next test case.
48 self.runCmd('type category delete TSLSFormatters', check=False)
49 self.runCmd('type format clear', check=False)
50 self.runCmd('type summary clear', check=False)
51 self.runCmd('type filter clear', check=False)
52 self.runCmd('type synth clear', check=False)
54 self.addTearDownHook(cleanup)
56 self.runCmd("command script import tslsformatters.py")
59 "frame variable myStruct",
60 substrs=['A data formatter at work'])
62 self.expect('type summary list', substrs=['Struct_SummaryFormatter'])
64 'type summary list Struct',
65 substrs=['Struct_SummaryFormatter'])