1""" 2Tests that C++ member and static variables have correct layout and scope. 3""" 4 5 6 7import unittest2 8import lldb 9from lldbsuite.test.decorators import * 10from lldbsuite.test.lldbtest import * 11from lldbsuite.test import lldbutil 12 13 14class TestCase(TestBase): 15 16 mydir = TestBase.compute_mydir(__file__) 17 18 # We fail to lookup static members on Windows. 19 @expectedFailureAll(oslist=["windows"]) 20 def test_access_from_main(self): 21 self.build() 22 lldbutil.run_to_source_breakpoint(self, "// stop in main", lldb.SBFileSpec("main.cpp")) 23 24 self.expect_expr("my_a.m_a", result_type="short", result_value="1") 25 self.expect_expr("my_a.s_b", result_type="long", result_value="2") 26 self.expect_expr("my_a.s_c", result_type="int", result_value="3") 27 28 # We fail to lookup static members on Windows. 29 @expectedFailureAll(oslist=["windows"]) 30 def test_access_from_member_function(self): 31 self.build() 32 lldbutil.run_to_source_breakpoint(self, "// stop in member function", lldb.SBFileSpec("main.cpp")) 33 self.expect_expr("m_a", result_type="short", result_value="1") 34 self.expect_expr("s_b", result_type="long", result_value="2") 35 self.expect_expr("s_c", result_type="int", result_value="3") 36 37 # Currently lookups find variables that are in any scope. 38 @expectedFailureAll() 39 def test_access_without_scope(self): 40 self.build() 41 self.createTestTarget() 42 self.expect("expression s_c", error=True, 43 startstr="error: use of undeclared identifier 's_d'") 44