================
@@ -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;
+ // Position of the memory buffer.
+ addr_t mem_pos = low;
+ // Maximum number of bytes read (and buffered). We need to read at least
+ // `size` bytes for a successful match.
+ const size_t max_read_size = std::max<size_t>(size, 0x10000);
+
+ for (addr_t s = low; s <= (high - size);) {
----------------
DavidSpickett wrote:
Maybe instead of `s`, `current_addr`? There's a lot of "s" things already
between the read size and the block size so s is a bit confusing.
https://github.com/llvm/llvm-project/pull/104193
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits