================
@@ -276,16 +276,29 @@ Status ProcessDebugger::ReadMemory(lldb::addr_t vm_addr,
void *buf, size_t size,
LLDB_LOG(log, "attempting to read {0} bytes from address {1:x}", size,
vm_addr);
- HostProcess process = m_session_data->m_debugger->GetProcess();
+ lldb::process_t handle = m_session_data->m_debugger->GetProcess()
+ .GetNativeProcess()
+ .GetSystemHandle();
void *addr = reinterpret_cast<void *>(vm_addr);
SIZE_T num_of_bytes_read = 0;
- if (!::ReadProcessMemory(process.GetNativeProcess().GetSystemHandle(), addr,
- buf, size, &num_of_bytes_read)) {
- error = Status(GetLastError(), eErrorTypeWin32);
- LLDB_LOG(log, "reading failed with error: {0}", error);
- } else {
+ if (::ReadProcessMemory(handle, addr, buf, size, &num_of_bytes_read)) {
+ bytes_read = num_of_bytes_read;
+ return Status();
+ }
+ error = Status(GetLastError(), eErrorTypeWin32);
+ MemoryRegionInfo info;
+ if (GetMemoryRegionInfo(vm_addr, info).Fail() ||
----------------
labath wrote:
Option 1, sort of :p.
There is a higher-level retry logic in `Process::ReadMemoryFromInferior` which
will ensure we read the both of the regions in this case. Doing it that way is
slightly less efficient that chunking the reads directly in this function, but
I don't think it's worth optimizing for that.
https://github.com/llvm/llvm-project/pull/106981
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits