================
@@ -0,0 +1,34 @@
+"""
+Test DIL pointer dereferencing.
+"""
+
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from lldbsuite.test import lldbutil
+
+import os
+import shutil
+import time
+
+
+class TestFrameVarDILPointerDereference(TestBase):
+    NO_DEBUG_INFO_TESTCASE = True
+
+    def test_frame_var(self):
+        self.build()
+        lldbutil.run_to_source_breakpoint(
+            self, "Set a breakpoint here", lldb.SBFileSpec("main.cpp")
+        )
+
+        self.runCmd("settings set target.experimental.use-DIL true")
+        self.expect_var_path("*p_int0", value="0")
+        self.expect_var_path("*cp_int5", value="5")
+        self.expect_var_path("&pp_void0[2]", type="void **")
+        self.expect_var_path("**pp_int0", value="0")
+        self.expect_var_path("&**pp_int0", type="int *")
----------------
labath wrote:

Since the goal here is to explicitly check handling pointer arithmetic, you may 
want to add additional checks for the values you get this way. 
`expect_var_path` returns the SBValue it has located, so you could do something 
like:
```
pp_void0_2_got = self.expect_var_path("&pp_void0[2]", type="void **")
pp_void0_2_exp = self.expect_var_path("pp_void0_2", type="void **") # 
Initialized in C++ code to point to the same value
self.assertEqual(pp_void0_2_got.GetValueAsAddress(), 
pp_void0_2_exp.GetValueAsAddress())
```

https://github.com/llvm/llvm-project/pull/143786
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to