slydiman wrote: > It also reads the memory in bulk (up to 1MB)
``` // 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); ``` It seems the minimal chunk is 64KB and the maximal chunk may be very long (more than 1MB). Something is wrong with the first memory block in tests ``` Got output: data found at location: 0x7f6bdf3eb000 0x7f6bdf3eb000: 6e 65 65 64 6c 65 00 00 00 00 00 00 00 00 00 00 needle.......... 0x7f6bdf3eb010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ data found at location: 0x7f6bdf3eb800 0x7f6bdf3eb800: 6e 65 65 64 6c 65 00 00 00 00 00 00 00 00 00 00 needle.......... 0x7f6bdf3eb810: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ data found at location: 0x7f6bdf3edff9 0x7f6bdf3edff9: 6e 65 65 64 6c 65 00 50 e0 3e df 6b 7f 00 00 6d needle.P.>.k...m 0x7f6bdf3ee009: dd 41 df 6b 7f 00 00 00 00 00 00 00 00 00 00 40 .A.k...........@ no more matches within the range. Expecting sub string: "data found at location: 0x7f6bdf3e9000" (was not found) ``` Note the capacity=0 is a special case here `llvm::SmallVector<uint8_t, 0> mem;` I'd recommend ``` const size_t min_read_size = 0x10000; const size_t max_read_size = std::max<size_t>(size, min_read_size); llvm::SmallVector<uint8_t, min_read_size> mem; ``` https://github.com/llvm/llvm-project/pull/104193 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits