[Lldb-commits] [lldb] [lldb] New expedited register specfication for unavailable regs (PR #193894)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 24 05:54:09 PDT 2026


================
@@ -0,0 +1,105 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
+
+# Test that lldb will cache when a register is unavailable,
+# and not request the value multiple times at a stop event.
+#
+# Also test that a stop reply packet which indicates that
+# the register cannot be read currently will keep lldb from
+# trying to read it again.
+
+
+class TestUnavailableRegisters(GDBRemoteTestBase):
+    @skipIfXmlSupportMissing
+    @skipIfLLVMTargetMissing("AArch64")
+    def test(self):
+        class MyResponder(MockGDBServerResponder):
+            def __init__(self):
+                super().__init__()
+                self.initial_x2_read = True
+
+            def haltReason(self):
+                return "T02thread:1ff0d;threads:1ff0d;thread-pcs:000000010001bc00;00:0100000000000000;01:;03:0500000000000000;04:00bc010001000000;"
+
+            def threadStopInfo(self, threadnum):
+                return "T02thread:1ff0d;threads:1ff0d;thread-pcs:000000010001bc00;00:0100000000000000;01:;03:0500000000000000;04:00bc010001000000;"
+
+            def writeRegisters(self):
+                return "E02"
+
+            def qHostInfo(self):
+                return "cputype:16777228;cpusubtype:2;endian:little;ptrsize:8;"
+
+            def readRegisters(self):
+                return "E01"
+
+            def readRegister(self, regnum):
+                # Register 1 was listed in the stop reply packet's expedited
+                # registers as unavailable.  lldb should not send a "p1" to try
+                # to read it.  Send back a value so we can detect if this happened.
+                if regnum == 1:
+                    return "5555555555555555"
----------------
DavidSpickett wrote:

Oh I see the idea. You are expecting errors on the other side of this, so it will be a noisy test failure if some actual value is returned.

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


More information about the lldb-commits mailing list