[Lldb-commits] [lldb] [lldb] Respect max packet size limits for MultiMemRead in ProcessGDBRemote (PR #172022)
Sergei Barannikov via lldb-commits
lldb-commits at lists.llvm.org
Thu Apr 9 12:14:20 PDT 2026
================
@@ -2790,29 +2790,64 @@ size_t ProcessGDBRemote::DoReadMemory(addr_t addr, void *buf, size_t size,
return 0;
}
+/// Returns the number of ranges that is safe to request using MultiMemRead
+/// while respecting max_packet_size.
+static uint64_t ComputeNumRangesMultiMemRead(
+ uint64_t max_packet_size,
+ llvm::ArrayRef<Range<lldb::addr_t, size_t>> ranges) {
+ // Each range is specified by two numbers (up to 16 ASCII characters) and one
+ // comma.
+ constexpr uint64_t range_overhead = 33;
+ uint64_t current_size = 0;
----------------
s-barannikov wrote:
`current_size` is never updated, I suppose it should accumulate `range.size`?
https://github.com/llvm/llvm-project/pull/172022
More information about the lldb-commits
mailing list