2 Tests that C++ member and static variables are available where they should be.
5 from lldbsuite.test.lldbtest import *
6 import lldbsuite.test.lldbutil as lldbutil
8 class CPPThisTestCase(TestBase):
10 mydir = TestBase.compute_mydir(__file__)
12 #rdar://problem/9962849
13 @expectedFailureGcc # llvm.org/pr15439 The 'this' pointer isn't available during expression evaluation when stopped in an inlined member function.
14 @expectedFailureIcc # ICC doesn't emit correct DWARF inline debug info for inlined member functions
15 @expectedFailureWindows("llvm.org/pr24489: Name lookup not working correctly on Windows")
16 @expectedFailureWindows("llvm.org/pr24490: We shouldn't be using platform-specific names like `getpid` in tests")
17 @expectedFlakeyClang(bugnumber='llvm.org/pr23012', compiler_version=['>=','3.6']) # failed with totclang - clang3.7
18 def test_with_run_command(self):
19 """Test that the appropriate member variables are available when stopped in C++ static, inline, and const methods"""
21 self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
23 self.set_breakpoint(line_number('main.cpp', '// breakpoint 1'))
24 self.set_breakpoint(line_number('main.cpp', '// breakpoint 2'))
25 self.set_breakpoint(line_number('main.cpp', '// breakpoint 3'))
26 self.set_breakpoint(line_number('main.cpp', '// breakpoint 4'))
28 self.runCmd("process launch", RUN_SUCCEEDED)
30 self.expect("expression -- m_a = 2",
31 startstr = "(int) $0 = 2")
33 self.runCmd("process continue")
35 # This would be disallowed if we enforced const. But we don't.
36 self.expect("expression -- m_a = 2",
37 startstr = "(int) $1 = 2")
39 self.expect("expression -- (int)getpid(); m_a",
40 startstr = "(int) $2 = 2")
42 self.runCmd("process continue")
44 self.expect("expression -- s_a",
45 startstr = "(int) $3 = 5")
47 self.runCmd("process continue")
49 self.expect("expression -- m_a",
50 startstr = "(int) $4 = 2")
52 def set_breakpoint(self, line):
53 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=1, loc_exact=False)