]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/lang/cpp/this/TestCPPThis.py
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / lang / cpp / this / TestCPPThis.py
1 """
2 Tests that C++ member and static variables are available where they should be.
3 """
4 import lldb
5 from lldbsuite.test.lldbtest import *
6 import lldbsuite.test.lldbutil as lldbutil
7
8 class CPPThisTestCase(TestBase):
9     
10     mydir = TestBase.compute_mydir(__file__)
11     
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"""
20         self.build()
21         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
22
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'))
27
28         self.runCmd("process launch", RUN_SUCCEEDED)
29
30         self.expect("expression -- m_a = 2",
31                     startstr = "(int) $0 = 2")
32         
33         self.runCmd("process continue")
34         
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")
38         
39         self.expect("expression -- (int)getpid(); m_a", 
40                     startstr = "(int) $2 = 2")
41
42         self.runCmd("process continue")
43
44         self.expect("expression -- s_a",
45                     startstr = "(int) $3 = 5")
46
47         self.runCmd("process continue")
48
49         self.expect("expression -- m_a",
50                     startstr = "(int) $4 = 2")
51     
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)