• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import lldb
2from lldbsuite.test.decorators import *
3from lldbsuite.test.lldbtest import *
4from lldbsuite.test import lldbutil
5
6class TestCase(TestBase):
7
8    mydir = TestBase.compute_mydir(__file__)
9
10    @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
11    def test(self):
12        self.build()
13        lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.cpp"))
14
15        # Test that global variables contain the right scope operators.
16        global_vars = self.frame().GetVariables(False, False, True, False)
17        # ManualDWARFIndex using NameToDIE does not sort alphabetically.
18        global_var_names = sorted([v.GetName() for v in global_vars])
19        expected_var_names = ["::a", "A::a", "B::a", "C::a"]
20        self.assertEqual(global_var_names, expected_var_names)
21
22        # Test lookup in scopes.
23        self.expect_expr("A::a", result_value="1111")
24        self.expect_expr("B::a", result_value="2222")
25        self.expect_expr("C::a", result_value="3333")
26        self.expect_expr("::a", result_value="4444")
27        # Check that lookup without scope returns the same result.
28        self.expect_expr("a", result_value="4444")
29