[Lldb-commits] [lldb] [lldb] Fix setting CanJIT if memory cannot be allocated (PR #176099)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Jan 15 12:54:38 PST 2026
================
@@ -0,0 +1,44 @@
+from textwrap import dedent
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
+
+
+class MyResponder(MockGDBServerResponder):
+ def other(self, packet) -> str:
+ if packet.startswith("_M"):
+ return "E04"
+ else:
+ return super().other(packet)
+
+ def readRegister(self, regnum):
+ return "E01"
+
+ def readRegisters(self):
+ return "20000000000000002000000000000000f0c154bfffff00005daa985a8fea0b48f0b954bfffff0000ad13cce570150b48380000000000000070456abfffff0000a700000000000000000000000000000001010101010101010000000000000000f0c154bfffff00000f2700000000000008e355bfffff0000080e55bfffff0000281041000000000010de61bfffff00005c05000000000000f0c154bfffff000090fcffffffff00008efcffffffff00008ffcffffffff00000000000000000000001000000000000090fcffffffff000000d06cbfffff0000f0c154bfffff00000100000000000000d0b954bfffff0000e407400000000000d0b954bfffff0000e40740000000000000100000"
+
+
+class TestExprNoAlloc(GDBRemoteTestBase):
+ @skipIfRemote
+ @skipIfLLVMTargetMissing("AArch64")
+ def test(self):
+ """
+ Test that a simple expression can be evaluated when the server supports the '_M'
+ packet, but memory cannot be allocated, and it returns an error code response.
----------------
jimingham wrote:
We allocate memory in expression evaluation both to hold the JIT code and the expression results. We inject the result into the target so that you can pass the result of one expression to a subsequent expression even if the expression wants a reference to the value.
If the expression is sufficiently simple that we can IR interpret it in lldb, we won't need to allocate memory for the JIT code, but we will still need to insert the result into the target for reuse. We handle this in the case where there isn't a process, but I'm not sure what happens if we fail to allocate memory for the result when we have a live process.
https://github.com/llvm/llvm-project/pull/176099
More information about the lldb-commits
mailing list