2 Test lldb data formatter subsystem.
8 from lldbsuite.test.lldbtest import *
9 import lldbsuite.test.lldbutil as lldbutil
12 class PtrToArrayDataFormatterTestCase(TestBase):
14 mydir = TestBase.compute_mydir(__file__)
16 def test_with_run_command(self):
17 """Test that LLDB handles the clang typeclass Paren correctly."""
19 self.data_formatter_commands()
22 # Call super's setUp().
24 # Find the line number to break at.
25 self.line = line_number('main.cpp', '// Set break point at this line.')
27 def data_formatter_commands(self):
28 """Test that LLDB handles the clang typeclass Paren correctly."""
29 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
31 lldbutil.run_break_set_by_file_and_line(
32 self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
34 self.runCmd("run", RUN_SUCCEEDED)
36 # The stop reason of the thread should be breakpoint.
37 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
39 'stop reason = breakpoint'])
41 # This is the function to remove the custom formats in order to have a
42 # clean slate for the next test case.
44 self.runCmd('type format delete hex', check=False)
45 self.runCmd('type summary clear', check=False)
47 # Execute the cleanup function during test case tear down.
48 self.addTearDownHook(cleanup)
50 self.expect('p *(int (*)[3])foo',
51 substrs=['(int [3]) $', '[0] = 1', '[1] = 2', '[2] = 3'])
53 self.expect('p *(int (*)[3])foo', matching=False,
54 substrs=['01 00 00 00 02 00 00 00 03 00 00 00'])
55 self.expect('p *(int (*)[3])foo', matching=False,
56 substrs=['0x000000030000000200000001'])