2 Test lldb data formatter subsystem.
8 from lldbsuite.test.lldbtest import *
9 import lldbsuite.test.lldbutil as lldbutil
12 class LanguageCategoryUpdatesTestCase(TestBase):
14 mydir = TestBase.compute_mydir(__file__)
17 # Call super's setUp().
19 # Find the line number to break at.
20 self.line = line_number('main.cpp', '// break here')
22 def test_with_run_command(self):
23 """Test that LLDB correctly cleans caches when language categories change."""
24 # This is the function to remove the custom formats in order to have a
25 # clean slate for the next test case.
29 'type_category') and hasattr(
32 self.type_category.DeleteTypeSummary(self.type_specifier)
34 # Execute the cleanup function during test case tear down.
35 self.addTearDownHook(cleanup)
38 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
40 lldbutil.run_break_set_by_file_and_line(
41 self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
43 self.runCmd("run", RUN_SUCCEEDED)
45 # The stop reason of the thread should be breakpoint.
46 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
48 'stop reason = breakpoint'])
59 self.type_category = self.dbg.GetCategory(
60 lldb.eLanguageTypeC_plus_plus)
61 type_summary = lldb.SBTypeSummary.CreateWithSummaryString(
62 "this is an object of type S")
63 self.type_specifier = lldb.SBTypeNameSpecifier('S')
64 self.type_category.AddTypeSummary(self.type_specifier, type_summary)
68 substrs=['this is an object of type S'],
71 self.type_category.DeleteTypeSummary(self.type_specifier)
74 substrs=['this is an object of type S'],