xref: /llvm-project-15.0.7/lldb/test/API/lang/objcxx/hide-runtime-values/TestObjCXXHideRuntimeValues.py (revision d9166ad2)
  • Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    @skipIfFreeBSD
13    @skipIfLinux
14    @skipIfWindows
15    @skipIfNetBSD
16    def test_hide_runtime_support_values(self):
17        self.build()
18        _, process, _, _ = lldbutil.run_to_source_breakpoint(
19            self, 'break here', lldb.SBFileSpec('main.mm'))
20
21        var_opts = lldb.SBVariablesOptions()
22        var_opts.SetIncludeArguments(True)
23        var_opts.SetIncludeLocals(True)
24        var_opts.SetInScopeOnly(True)
25        var_opts.SetIncludeStatics(False)
26        var_opts.SetIncludeRuntimeSupportValues(False)
27        var_opts.SetUseDynamic(lldb.eDynamicCanRunTarget)
28        values = self.frame().GetVariables(var_opts)
29
30        def shows_var(name):
31            for value in values:
32                if value.name == name:
33                    return True
34            return False
35        # ObjC method.
36        values = self.frame().GetVariables(var_opts)
37        self.assertFalse(shows_var("this"))
38        self.assertTrue(shows_var("self"))
39        self.assertTrue(shows_var("_cmd"))
40        self.assertTrue(shows_var("c"))
41
42        process.Continue()
43        # C++ method.
44        values = self.frame().GetVariables(var_opts)
45        self.assertTrue(shows_var("this"))
46        self.assertFalse(shows_var("self"))
47        self.assertFalse(shows_var("_cmd"))
48

served by {OpenGrok

Last Index Update: Fri May 15 20:09:11 GMT 2026