================
@@ -45,3 +45,26 @@ def test_NSError_p(self):
             ],
         )
         self.runCmd("process continue")
+
+    @skipIfOutOfTreeDebugserver
+    def test_runtime_types_efficient_memreads(self):
+        # Test that we use an efficient reading of memory when reading
+        # Objective-C method descriptions.
+        logfile = os.path.join(self.getBuildDir(), "log.txt")
+        self.runCmd(f"log enable -f {logfile} gdb-remote packets process")
+        self.addTearDownHook(lambda: self.runCmd("log disable gdb-remote 
packets"))
+
+        self.build()
+        self.target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
+            self, "// Break here for NSString tests", 
lldb.SBFileSpec("main.m", False)
+        )
+
+        self.runCmd(f"proc plugin packet send StartTesting", check=False)
+        self.expect('expression str = [NSString stringWithCString: "new"]')
+        self.runCmd(f"proc plugin packet send EndTesting", check=False)
+
+        self.assertTrue(os.path.exists(logfile))
+        log_text = open(logfile).read()
+        log_text = log_text.split("StartTesting", 1)[-1].split("EndTesting", 
1)[0]
+        self.assertIn("MultiMemRead:", log_text)
----------------
jasonmolenda wrote:

If we had a command that exclusively could be completed with only a 
MultiMemRead, we might be able to assert that no x/m packets were sent.  But 
this core operation will still do memory reads to get c-strings for the 
methods; we didn't tackle Process::MultiCStringRead, but even if we had there 
would be a handful of simple memory reads issued while evaluating the 
expression.  I think confirming the presence of at least one MultiMemRead: 
packet may be the best we could do here.  

https://github.com/llvm/llvm-project/pull/164311
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to