Debian Codegraph @

lldb/test/API/commands/frame/var-dil/basics/PointerDereference/TestFrameVarDILPointerDereference.py

raw
1 """
2 Test DIL pointer dereferencing.
3 """
4
5 import lldb
6 from lldbsuite.test.lldbtest import *
7 from lldbsuite.test.decorators import *
8 from lldbsuite.test import lldbutil
9
10 import os
11 import shutil
12 import time
13
14
15 class TestFrameVarDILPointerDereference(TestBase):
16 NO_DEBUG_INFO_TESTCASE = True
17
18 def test_frame_var(self):
19 self.build()
20 lldbutil.run_to_source_breakpoint(
21 self, "Set a breakpoint here", lldb.SBFileSpec("main.cpp")
22 )
23
24 self.runCmd("settings set target.experimental.use-DIL true")
25 self.expect_var_path("*p_int0", value="0")
26 self.expect_var_path("*cp_int5", value="5")
27 self.expect_var_path("&pp_void0[2]", type="void **")
28 self.expect_var_path("**pp_int0", value="0")
29 self.expect_var_path("&**pp_int0", type="int *")
30 self.expect(
31 "frame variable '&p_void[0]'",
32 error=True,
33 substrs=["subscript of pointer to incomplete type 'void'"],
34 )
35
36 # Verify some of the returned values.
37 pp_void0_2_got = self.expect_var_path("&pp_void0[2]", type="void **")
38 # Initialized in C++ code to point to the same value
39 pp_void0_2_exp = self.expect_var_path("pp_void0_2", type="void **")
40 self.assertEqual(
41 pp_void0_2_got.GetValueAsAddress(), pp_void0_2_exp.GetValueAsAddress()
42 )
43 pp_int0_2stars_got = self.expect_var_path("&**pp_int0", type="int *")
44 pp_int0_2stars_exp = self.expect_var_path("pp_int0_2stars", type="int *")
45 self.assertEqual(
46 pp_int0_2stars_got.GetValueAsAddress(),
47 pp_int0_2stars_exp.GetValueAsAddress(),
48 )