[Lldb-commits] [lldb] [lldb] Fix and speedup the `memory find` command (PR #104193)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 27 16:13:36 PDT 2024


================
@@ -3367,21 +3340,48 @@ lldb::addr_t Process::FindInMemory(lldb::addr_t low, lldb::addr_t high,
   if (region_size < size)
     return LLDB_INVALID_ADDRESS;
 
+  // See "Boyer-Moore string search algorithm".
   std::vector<size_t> bad_char_heuristic(256, size);
-  ProcessMemoryIterator iterator(*this, low);
-
   for (size_t idx = 0; idx < size - 1; idx++) {
     decltype(bad_char_heuristic)::size_type bcu_idx = buf[idx];
     bad_char_heuristic[bcu_idx] = size - idx - 1;
   }
-  for (size_t s = 0; s <= (region_size - size);) {
+
+  // Memory we're currently searching through.
+  llvm::SmallVector<uint8_t, 0> mem;
----------------
clayborg wrote:

If you are setting N = 0 for the `llvm::SmallVector`, might as well just use `std::vector`?

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


More information about the lldb-commits mailing list