[Lldb-commits] [lldb] r209341 - Change ProcessKDP::DoReadMemory() to break up large memory
Jason Molenda
jmolenda at apple.com
Wed May 21 16:44:02 PDT 2014
Author: jmolenda
Date: Wed May 21 18:44:02 2014
New Revision: 209341
URL: http://llvm.org/viewvc/llvm-project?rev=209341&view=rev
Log:
Change ProcessKDP::DoReadMemory() to break up large memory
read requests into smaller chunks; some remote kdp stubs
cannot handle memory reads larger than a KB or two & will
error out.
<rdar://problem/16983125>
Modified:
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=209341&r1=209340&r2=209341&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Wed May 21 18:44:02 2014
@@ -647,8 +647,32 @@ ProcessKDP::IsAlive ()
size_t
ProcessKDP::DoReadMemory (addr_t addr, void *buf, size_t size, Error &error)
{
+ uint8_t *data_buffer = (uint8_t *) buf;
if (m_comm.IsConnected())
- return m_comm.SendRequestReadMemory (addr, buf, size, error);
+ {
+ const size_t max_read_size = 512;
+ size_t total_bytes_read = 0;
+
+ // Read the requested amount of memory in 512 byte chunks
+ while (total_bytes_read < size)
+ {
+ size_t bytes_to_read_this_request = size - total_bytes_read;
+ if (bytes_to_read_this_request > max_read_size)
+ {
+ bytes_to_read_this_request = max_read_size;
+ }
+ size_t bytes_read = m_comm.SendRequestReadMemory (addr + total_bytes_read,
+ data_buffer + total_bytes_read,
+ bytes_to_read_this_request, error);
+ total_bytes_read += bytes_read;
+ if (error.Fail() || bytes_read == 0)
+ {
+ return total_bytes_read;
+ }
+ }
+
+ return total_bytes_read;
+ }
error.SetErrorString ("not connected");
return 0;
}
More information about the lldb-commits
mailing list