[Lldb-commits] [lldb] [lldb] Fix and speedup the `memory find` command (PR #104193)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 28 08:16:50 PDT 2024
================
@@ -79,3 +83,25 @@ def test_memory_find(self):
'memory find -s "nothere" `stringdata` `stringdata+10`',
substrs=["data not found within the range."],
)
+
+ @expectedFailureWindows
+ def test_memory_find_with_holes(self):
+ self._prepare_inferior()
+
+ self.runCmd("log enable gdb-remote packets")
+ self.runCmd("log enable lldb process target")
+
+ pagesize = self.frame().FindVariable("pagesize").GetValueAsUnsigned()
+ mem_with_holes = (
+ self.frame().FindVariable("mem_with_holes").GetValueAsUnsigned()
+ )
+ matches_var = self.frame().FindVariable("matches")
+ self.assertEqual(matches_var.GetNumChildren(), 4)
+ matches = [
+ f"data found at location: {matches_var.GetChildAtIndex(i).GetValueAsUnsigned():#x}"
+ for i in range(4)
+ ]
+ self.expect(
+ 'memory find -c 5 -s "needle" `mem_with_holes` `mem_with_holes+5*pagesize`',
----------------
DavidSpickett wrote:
Could remove a magic number if the program had a `mem_with_holes_end` var, but you'd need the 5 for `--count` still anyway and you could do `sizeof(...` to get that but that makes the test's expectations unclear IMO.
...so leave it as is but I did think about it.
https://github.com/llvm/llvm-project/pull/104193
More information about the lldb-commits
mailing list