[Lldb-commits] [lldb] [LLDB] Update DIL to handle smart pointers; add more tests. (PR #143786)

via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 11 14:29:10 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


:warning: Python code formatter, darker found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r HEAD~1...HEAD lldb/test/API/commands/frame/var-dil/basics/BitField/TestFrameVarDILBitField.py lldb/test/API/commands/frame/var-dil/basics/Indirection/TestFrameVarDILIndirection.py lldb/test/API/commands/frame/var-dil/basics/PointerDereference/TestFrameVarDILPointerDereference.py lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py lldb/test/API/commands/frame/var-dil/basics/SharedPtr/TestFrameVarDILSharedPtr.py lldb/test/API/commands/frame/var-dil/basics/SharedPtr/TestFrameVarDILSharedPtrDeref.py lldb/test/API/commands/frame/var-dil/basics/UniquePtr/TestFrameVarDILUniquePtr.py lldb/test/API/commands/frame/var-dil/basics/UniquePtr/TestFrameVarDILUniquePtrDeref.py
``````````

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- BitField/TestFrameVarDILBitField.py	2025-06-11 21:24:17.000000 +0000
+++ BitField/TestFrameVarDILBitField.py	2025-06-11 21:28:41.266823 +0000
@@ -9,20 +9,22 @@
 
 import os
 import shutil
 import time
 
+
 class TestFrameVarDILBitField(TestBase):
     # If your test case doesn't stress debug info, then
     # set this to true.  That way it won't be run once for
     # each debug info format.
     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"))
+        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("bf.a", value="1023")
         self.expect_var_path("bf.b", value="9")
         self.expect_var_path("bf.c", value="false")
@@ -32,7 +34,10 @@
         self.expect_var_path("abf.b", value="'\\x0f'")
         self.expect_var_path("abf.c", value="3")
 
         # Perform an operation to ensure we actually read the value.
         # Address-of is not allowed for bit-fields.
-        self.expect("frame variable '&bf.a'", error=True,
-                    substrs=["'bf.a' doesn't have a valid address"])
+        self.expect(
+            "frame variable '&bf.a'",
+            error=True,
+            substrs=["'bf.a' doesn't have a valid address"],
+        )
--- Indirection/TestFrameVarDILIndirection.py	2025-06-11 21:24:17.000000 +0000
+++ Indirection/TestFrameVarDILIndirection.py	2025-06-11 21:28:41.283161 +0000
@@ -9,28 +9,38 @@
 
 import os
 import shutil
 import time
 
+
 class TestFrameVarDILIndirection(TestBase):
     # If your test case doesn't stress debug info, then
     # set this to true.  That way it won't be run once for
     # each debug info format.
     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"))
+        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", value="1")
         self.expect_var_path("p", type="int *")
         self.expect_var_path("*my_p", value="1")
         self.expect_var_path("my_p", type="myp")
         self.expect_var_path("*my_pr", type="int *")
         self.expect_var_path("my_pr", type="mypr")
 
-        self.expect("frame variable '*1'", error=True,
-                    substrs=["Unexpected token: <'1' (numeric_constant)>"])
-        self.expect("frame variable '*val'", error=True,
-                    substrs=["dereference failed: not a pointer, reference or array type: (int) val"])
+        self.expect(
+            "frame variable '*1'",
+            error=True,
+            substrs=["Unexpected token: <'1' (numeric_constant)>"],
+        )
+        self.expect(
+            "frame variable '*val'",
+            error=True,
+            substrs=[
+                "dereference failed: not a pointer, reference or array type: (int) val"
+            ],
+        )
--- PointerDereference/TestFrameVarDILPointerDereference.py	2025-06-11 21:24:17.000000 +0000
+++ PointerDereference/TestFrameVarDILPointerDereference.py	2025-06-11 21:28:41.296676 +0000
@@ -8,10 +8,11 @@
 from lldbsuite.test import lldbutil
 
 import os
 import shutil
 import time
+
 
 class TestFrameVarDILPointerDereference(TestBase):
     NO_DEBUG_INFO_TESTCASE = True
 
     def test_frame_var(self):
@@ -24,7 +25,10 @@
         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 *")
-        self.expect("frame variable '&p_void[0]'", error=True,
-                    substrs=["subscript of pointer to incomplete type 'void'"])
+        self.expect(
+            "frame variable '&p_void[0]'",
+            error=True,
+            substrs=["subscript of pointer to incomplete type 'void'"],
+        )
--- QualifiedId/TestFrameVarDILQualifiedId.py	2025-06-11 21:24:17.000000 +0000
+++ QualifiedId/TestFrameVarDILQualifiedId.py	2025-06-11 21:28:41.309201 +0000
@@ -9,20 +9,22 @@
 
 import os
 import shutil
 import time
 
+
 class TestFrameVarDILQualifiedId(TestBase):
     # If your test case doesn't stress debug info, then
     # set this to true.  That way it won't be run once for
     # each debug info format.
     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"))
+        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("::ns::i", value="1")
         self.expect_var_path("ns::i", value="1")
         self.expect_var_path("::ns::ns::i", value="2")
--- SharedPtr/TestFrameVarDILSharedPtr.py	2025-06-11 21:24:17.000000 +0000
+++ SharedPtr/TestFrameVarDILSharedPtr.py	2025-06-11 21:28:41.322638 +0000
@@ -9,28 +9,33 @@
 
 import os
 import shutil
 import time
 
+
 class TestFrameVarDILSharedPtr(TestBase):
     # If your test case doesn't stress debug info, then
     # set this to true.  That way it won't be run once for
     # each debug info format.
     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"))
+        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("ptr_node.__ptr_",
-                    type="std::shared_ptr<NodeS>::element_type *")
+        self.expect_var_path(
+            "ptr_node.__ptr_", type="std::shared_ptr<NodeS>::element_type *"
+        )
         self.expect_var_path("ptr_node.__ptr_->value", value="1")
         self.expect_var_path("ptr_node.__ptr_->next.__ptr_->value", value="2")
 
-        self.expect_var_path("ptr_int.__ptr_",
-                    type="std::shared_ptr<int>::element_type *")
+        self.expect_var_path(
+            "ptr_int.__ptr_", type="std::shared_ptr<int>::element_type *"
+        )
         self.expect_var_path("*ptr_int.__ptr_", value="1")
-        self.expect_var_path("ptr_int_weak.__ptr_",
-                    type="std::weak_ptr<int>::element_type *")
+        self.expect_var_path(
+            "ptr_int_weak.__ptr_", type="std::weak_ptr<int>::element_type *"
+        )
         self.expect_var_path("*ptr_int_weak.__ptr_", value="1")
--- SharedPtr/TestFrameVarDILSharedPtrDeref.py	2025-06-11 21:24:17.000000 +0000
+++ SharedPtr/TestFrameVarDILSharedPtrDeref.py	2025-06-11 21:28:41.334765 +0000
@@ -9,20 +9,22 @@
 
 import os
 import shutil
 import time
 
+
 class TestFrameVarDILSharedPtrDeref(TestBase):
     # If your test case doesn't stress debug info, then
     # set this to true.  That way it won't be run once for
     # each debug info format.
     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"))
+        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("ptr_node->value", value="1")
         self.expect_var_path("ptr_node->next->value", value="2")
         self.expect_var_path("(*ptr_node).value", value="1")
--- UniquePtr/TestFrameVarDILUniquePtr.py	2025-06-11 21:24:17.000000 +0000
+++ UniquePtr/TestFrameVarDILUniquePtr.py	2025-06-11 21:28:41.346844 +0000
@@ -9,20 +9,22 @@
 
 import os
 import shutil
 import time
 
+
 class TestFrameVarDILUniquePtr(TestBase):
     # If your test case doesn't stress debug info, then
     # set this to true.  That way it won't be run once for
     # each debug info format.
     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"))
+        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("ptr_node.__ptr_", type="NodeU *")
         self.expect_var_path("ptr_node.__ptr_->value", value="1")
         self.expect_var_path("ptr_node.__ptr_->next.__ptr_->value", value="2")
--- UniquePtr/TestFrameVarDILUniquePtrDeref.py	2025-06-11 21:24:17.000000 +0000
+++ UniquePtr/TestFrameVarDILUniquePtrDeref.py	2025-06-11 21:28:41.358681 +0000
@@ -9,20 +9,22 @@
 
 import os
 import shutil
 import time
 
+
 class TestFrameVarDILUniquePtrDeref(TestBase):
     # If your test case doesn't stress debug info, then
     # set this to true.  That way it won't be run once for
     # each debug info format.
     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"))
+        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("ptr_node->value", value="1")
         self.expect_var_path("ptr_node->next->value", value="2")
         self.expect_var_path("(*ptr_node).value", value="1")

``````````

</details>


https://github.com/llvm/llvm-project/pull/143786


More information about the lldb-commits mailing list