[Lldb-commits] [lldb] [lldb][test] Check the sp lookup in register sets that have no rsp (PR #229401)

via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 6 05:40:43 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Charles Zablit (charles-zablit)

<details>
<summary>Changes</summary>

Since llvm#<!-- -->223857, `GetIndexOfChildWithName("sp")` in a set holding the architectural sp but not rsp (Windows "supplementary registers") finds that sp, but the early continue from llvm#<!-- -->226176 skips those sets, so the else block asserting it never ran.

This patch drops it and compares against "esp" on i386, where sp shares a set with esp and the continue was what kept the else branch from failing. x86_64 sets that hold rsp are checked as before.


---
Full diff: https://github.com/llvm/llvm-project/pull/229401.diff


1 Files Affected:

- (modified) lldb/test/API/python_api/value/TestValueAPI.py (+9-14) 


``````````diff
diff --git a/lldb/test/API/python_api/value/TestValueAPI.py b/lldb/test/API/python_api/value/TestValueAPI.py
index d42dcbf79b6ff..a8c6141413bc4 100644
--- a/lldb/test/API/python_api/value/TestValueAPI.py
+++ b/lldb/test/API/python_api/value/TestValueAPI.py
@@ -308,24 +308,19 @@ def test_register(self):
                     and reg_name == "sp"
                 ):
                     # x86 has "rsp", and "sp" which is a subset of "rsp". Then there is
-                    # the ABI name "sp", which LLDB resolves to "rsp", not to the
-                    # architectural register "sp".
+                    # the ABI name "sp", which LLDB resolves to "rsp" ("esp" on i386),
+                    # not to the architectural register "sp".
                     # See https://github.com/llvm/llvm-project/issues/212778.
-                    #
-                    # Some targets expose the architectural "sp" in a different
-                    # set than "rsp" (on Windows, "supplementary registers"),
-                    # leaving nothing to compare against here.
-                    if not reg_set.GetChildMemberWithName("rsp").IsValid():
-                        continue
-
+                    full_sp = "esp" if self.getArchitecture() == "i386" else "rsp"
                     sp_with_name_index = reg_set.GetIndexOfChildWithName(reg_name)
                     self.assertTrue(sp_with_name_index < num_registers)
-                    rsp_with_name_index = reg_set.GetIndexOfChildWithName("rsp")
-                    if rsp_with_name_index < num_registers:
-                        self.assertEqual(sp_with_name_index, rsp_with_name_index)
+                    full_sp_with_name_index = reg_set.GetIndexOfChildWithName(full_sp)
+                    if full_sp_with_name_index < num_registers:
+                        self.assertEqual(sp_with_name_index, full_sp_with_name_index)
                     else:
-                        # "rsp" is not in this set, so we get the architectural
-                        # "sp" instead.
+                        # The full width register is not in this set (on Windows,
+                        # "sp" is in "supplementary registers"), so we get the
+                        # architectural "sp" instead.
                         self.assertEqual(sp_with_name_index, child_idx)
 
                     continue

``````````

</details>


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


More information about the lldb-commits mailing list