Skip to content

Commit b35e42f

Browse files
committed
Move to void* buffer instead of data buffer heap
1 parent eacd55c commit b35e42f

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

lldb/include/lldb/Target/Process.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,7 @@ class Process : public std::enable_shared_from_this<Process>,
15991599
// uint64_t bytes_read_for_chunk, the actual count of bytes read for this
16001600
// chunk
16011601
typedef std::function<IterationAction(lldb_private::Status &, const void *,
1602-
lldb::addr_t, uint64_t, uint64_t)>
1602+
lldb::addr_t, uint64_t, uint64_t)>
16031603
ReadMemoryChunkCallback;
16041604

16051605
/// Read of memory from a process in discrete chunks, terminating

lldb/source/Target/Process.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,27 +2234,27 @@ size_t Process::ReadMemoryFromInferior(addr_t addr, void *buf, size_t size,
22342234
}
22352235

22362236
size_t Process::ReadMemoryInChunks(lldb::addr_t vm_addr, void *buf,
2237-
lldb::addr_t chunk_size, size_t size,
2238-
ReadMemoryChunkCallback callback) {
2239-
// Safety check to prevent an infinite loop.
2240-
if (chunk_size == 0)
2241-
return 0;
2242-
2243-
// Create a data buffer heap of the specified size, initialized to 0.
2244-
uint64_t bytes_remaining = size;
2245-
uint64_t bytes_read = 0;
2246-
Status error;
2247-
while (bytes_remaining > 0) {
2248-
// Get the next read chunk size as the minimum of the remaining bytes and
2249-
// the write chunk max size.
2250-
const size_t bytes_to_read = std::min(bytes_remaining, chunk_size);
2251-
const lldb::addr_t current_addr = vm_addr + bytes_read;
2252-
const size_t bytes_read_for_chunk =
2253-
ReadMemoryFromInferior(current_addr, buf, bytes_to_read, error);
2254-
2255-
if (callback(error, buf, current_addr, bytes_to_read,
2256-
bytes_read_for_chunk) == IterationAction::Stop)
2257-
break;
2237+
lldb::addr_t chunk_size, size_t size,
2238+
ReadMemoryChunkCallback callback) {
2239+
// Safety check to prevent an infinite loop.
2240+
if (chunk_size == 0)
2241+
return 0;
2242+
2243+
// Create a data buffer heap of the specified size, initialized to 0.
2244+
uint64_t bytes_remaining = size;
2245+
uint64_t bytes_read = 0;
2246+
Status error;
2247+
while (bytes_remaining > 0) {
2248+
// Get the next read chunk size as the minimum of the remaining bytes and
2249+
// the write chunk max size.
2250+
const size_t bytes_to_read = std::min(bytes_remaining, chunk_size);
2251+
const lldb::addr_t current_addr = vm_addr + bytes_read;
2252+
const size_t bytes_read_for_chunk =
2253+
ReadMemoryFromInferior(current_addr, buf, bytes_to_read, error);
2254+
2255+
if (callback(error, buf, current_addr, bytes_to_read,
2256+
bytes_read_for_chunk) == IterationAction::Stop)
2257+
break;
22582258

22592259
bytes_read += bytes_read_for_chunk;
22602260
// If the bytes read in this chunk would cause us to overflow, something

0 commit comments

Comments
 (0)