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
15 class LanguageCategoryUpdatesTestCase(TestBase):
17 mydir = TestBase.compute_mydir(__file__)
20 # Call super's setUp().
22 # Find the line number to break at.
23 self.line = line_number('main.cpp', '// break here')
25 def test_with_run_command(self):
26 """Test that LLDB correctly cleans caches when language categories change."""
27 # This is the function to remove the custom formats in order to have a
28 # clean slate for the next test case.
32 'type_category') and hasattr(
35 self.type_category.DeleteTypeSummary(self.type_specifier)
37 # Execute the cleanup function during test case tear down.
38 self.addTearDownHook(cleanup)
41 self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
43 lldbutil.run_break_set_by_file_and_line(
44 self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
46 self.runCmd("run", RUN_SUCCEEDED)
48 # The stop reason of the thread should be breakpoint.
49 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
51 'stop reason = breakpoint'])
62 self.type_category = self.dbg.GetCategory(
63 lldb.eLanguageTypeC_plus_plus)
64 type_summary = lldb.SBTypeSummary.CreateWithSummaryString(
65 "this is an object of type S")
66 self.type_specifier = lldb.SBTypeNameSpecifier('S')
67 self.type_category.AddTypeSummary(self.type_specifier, type_summary)
71 substrs=['this is an object of type S'],
74 self.type_category.DeleteTypeSummary(self.type_specifier)
77 substrs=['this is an object of type S'],