brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 8eab759 Raw
39 lines · python
1"""2Test DIL address calculation.3"""4 5import lldb6from lldbsuite.test.lldbtest import *7from lldbsuite.test.decorators import *8from lldbsuite.test import lldbutil9 10 11class TestFrameVarDILGlobalVariableLookup(TestBase):12    NO_DEBUG_INFO_TESTCASE = True13 14    def expect_var_path(self, expr, compare_to_framevar=False, value=None, type=None):15        value_dil = super().expect_var_path(expr, value=value, type=type)16        if compare_to_framevar:17            self.runCmd("settings set target.experimental.use-DIL false")18            value_frv = super().expect_var_path(expr, value=value, type=type)19            self.runCmd("settings set target.experimental.use-DIL true")20            self.assertEqual(value_dil.GetValue(), value_frv.GetValue())21 22    def test_frame_var(self):23        self.build()24        lldbutil.run_to_source_breakpoint(25            self, "Set a breakpoint here", lldb.SBFileSpec("main.cpp")26        )27 28        self.runCmd("settings set target.experimental.use-DIL true")29        self.expect_var_path("&x", True, type="int *")30        self.expect_var_path("r", True, type="int &")31        self.expect_var_path("&r", True, type="int &*")32        self.expect_var_path("pr", True, type="int *&")33        self.expect_var_path("&pr", True, type="int *&*")34        self.expect_var_path("my_pr", True)35        self.expect_var_path("&my_pr", True, type="mypr *")36        self.expect_var_path("&globalVar", True, type="int *")37        self.expect_var_path("&s_str", True, type="const char **")38        self.expect_var_path("&argc", True, type="int *")39