Skip to content

Commit 95b7089

Browse files
fixup! address review comments
1 parent a0a13a6 commit 95b7089

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2795,14 +2795,20 @@ size_t ProcessGDBRemote::DoReadMemory(addr_t addr, void *buf, size_t size,
27952795
static uint64_t ComputeNumRangesMultiMemRead(
27962796
uint64_t max_packet_size,
27972797
llvm::ArrayRef<Range<lldb::addr_t, size_t>> ranges) {
2798-
// Each range is specified by two numbers (~16 ASCII characters) and one
2798+
// Each range is specified by two numbers (up to 16 ASCII characters) and one
27992799
// comma.
28002800
constexpr uint64_t range_overhead = 33;
28012801
uint64_t current_size = 0;
28022802
for (auto [idx, range] : llvm::enumerate(ranges)) {
28032803
uint64_t potential_size = current_size + range.size + range_overhead;
2804-
if (potential_size > max_packet_size)
2804+
if (potential_size > max_packet_size) {
2805+
if (idx == 0)
2806+
LLDB_LOG(GetLog(GDBRLog::Process),
2807+
"MultiMemRead input has a range (base = {0:x}, size = {1}) "
2808+
"bigger than the maximum allowed by remote",
2809+
range.base, range.size);
28052810
return idx;
2811+
}
28062812
}
28072813
return ranges.size();
28082814
}
@@ -2820,12 +2826,8 @@ ProcessGDBRemote::ReadMemoryRanges(
28202826
while (!ranges.empty()) {
28212827
uint64_t num_ranges =
28222828
ComputeNumRangesMultiMemRead(m_max_memory_size, ranges);
2823-
if (num_ranges == 0) {
2824-
LLDB_LOG(
2825-
GetLog(GDBRLog::Process),
2826-
"MultiMemRead has a range bigger than maximum allowed by remote");
2829+
if (num_ranges == 0)
28272830
return Process::ReadMemoryRanges(original_ranges, buffer);
2828-
}
28292831

28302832
auto ranges_for_request = ranges.take_front(num_ranges);
28312833
ranges = ranges.drop_front(num_ranges);

0 commit comments

Comments
 (0)