2 Test lldb data formatter subsystem.
8 from lldbsuite.test.lldbtest import *
9 import lldbsuite.test.lldbutil as lldbutil
12 class PtrRef2TypedefTestCase(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', '// Set breakpoint here')
22 def test_with_run_command(self):
23 """Test that a pointer/reference to a typedef is formatted as we want."""
25 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
27 lldbutil.run_break_set_by_file_and_line(
28 self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
30 self.runCmd("run", RUN_SUCCEEDED)
32 # The stop reason of the thread should be breakpoint.
33 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
35 'stop reason = breakpoint'])
37 # This is the function to remove the custom formats in order to have a
38 # clean slate for the next test case.
40 self.runCmd('type format clear', check=False)
41 self.runCmd('type summary clear', check=False)
43 # Execute the cleanup function during test case tear down.
44 self.addTearDownHook(cleanup)
46 self.runCmd('type summary add --cascade true -s "IntPointer" "int *"')
47 self.runCmd('type summary add --cascade true -s "IntLRef" "int &"')
48 self.runCmd('type summary add --cascade true -s "IntRRef" "int &&"')
55 # note: Ubuntu 12.04 x86_64 build with gcc 4.8.2 is getting a
56 # const after the ref that isn't showing up on FreeBSD. This
57 # tweak changes the behavior so that the const is not part of
60 "frame variable y", substrs=[
61 '(Foo &', ') y = 0x', 'IntLRef'])
63 "frame variable z", substrs=[
64 '(Foo &&', ') z = 0x', 'IntRRef'])