2 Test lldb data formatter subsystem.
8 from lldbsuite.test.lldbtest import *
9 from lldbsuite.test.decorators import *
10 import lldbsuite.test.lldbutil as lldbutil
13 class GlobalsDataFormatterTestCase(TestBase):
15 mydir = TestBase.compute_mydir(__file__)
18 # Call super's setUp().
20 # Find the line number to break at.
21 self.line = line_number('main.cpp', '// Set break point at this line.')
23 @skipIf(debug_info="gmodules",
24 bugnumber="https://bugs.llvm.org/show_bug.cgi?id=36048")
25 def test_with_run_command(self):
26 """Test that that file and class static variables display correctly."""
28 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
30 lldbutil.run_break_set_by_file_and_line(
31 self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
33 # This is the function to remove the custom formats in order to have a
34 # clean slate for the next test case.
36 self.runCmd('type format clear', check=False)
37 self.runCmd('type summary clear', check=False)
39 # Execute the cleanup function during test case tear down.
40 self.addTearDownHook(cleanup)
42 self.runCmd("type summary add --summary-string \"JustATest\" Point")
44 # Simply check we can get at global variables
45 self.expect("target variable g_point",
46 substrs=['JustATest'])
48 self.expect("target variable g_point_pointer",
49 substrs=['(Point *) g_point_pointer ='])
51 # Print some information about the variables
52 # (we ignore the actual values)
54 "type summary add --summary-string \"(x=${var.x},y=${var.y})\" Point")
56 self.expect("target variable g_point",
60 self.expect("target variable g_point_pointer",
61 substrs=['(Point *) g_point_pointer ='])
63 # Test Python code on resulting SBValue
65 "type summary add --python-script \"return 'x=' + str(valobj.GetChildMemberWithName('x').GetValue());\" Point")
67 self.expect("target variable g_point",
70 self.expect("target variable g_point_pointer",
71 substrs=['(Point *) g_point_pointer ='])