1import lldb
2from lldbsuite.test.lldbtest import *
3from lldbsuite.test.decorators import *
4import lldbsuite.test.lldbutil as lldbutil
5import unittest2
6
7
8class TestObjCXXHideRuntimeSupportValues(TestBase):
9
10    mydir = TestBase.compute_mydir(__file__)
11
12    def test_hide_runtime_support_values(self):
13        self.build()
14        _, process, _, _ = lldbutil.run_to_source_breakpoint(
15            self, 'break here', lldb.SBFileSpec('main.mm'))
16
17        var_opts = lldb.SBVariablesOptions()
18        var_opts.SetIncludeArguments(True)
19        var_opts.SetIncludeLocals(True)
20        var_opts.SetInScopeOnly(True)
21        var_opts.SetIncludeStatics(False)
22        var_opts.SetIncludeRuntimeSupportValues(False)
23        var_opts.SetUseDynamic(lldb.eDynamicCanRunTarget)
24        values = self.frame().GetVariables(var_opts)
25
26        def shows_var(name):
27            for value in values:
28                if value.name == name:
29                    return True
30            return False
31        # ObjC method.
32        values = self.frame().GetVariables(var_opts)
33        self.assertFalse(shows_var("this"))
34        self.assertTrue(shows_var("self"))
35        self.assertTrue(shows_var("_cmd"))
36        self.assertTrue(shows_var("c"))
37
38        process.Continue()
39        # C++ method.
40        values = self.frame().GetVariables(var_opts)
41        self.assertTrue(shows_var("this"))
42        self.assertFalse(shows_var("self"))
43        self.assertFalse(shows_var("_cmd"))
44