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

served by {OpenGrok

Last Index Update: Tue Oct 21 18:42:31 GMT 2025