[Lldb-commits] [PATCH] D61310: [lldb] [Process/NetBSD] Fix handling piod_len from PT_IO calls

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 30 07:47:58 PDT 2019


mgorny updated this revision to Diff 197326.
mgorny retitled this revision from "[lldb] [Process/NetBSD] Fix handling piod_len when reading memory" to "[lldb] [Process/NetBSD] Fix handling piod_len from PT_IO calls".
mgorny edited the summary of this revision.
mgorny added a comment.

Also included fixes for `WriteMemory()`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61310/new/

https://reviews.llvm.org/D61310

Files:
  lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp


Index: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
===================================================================
--- lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+++ lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
@@ -695,10 +695,10 @@
     io.piod_addr = dst + bytes_read;
 
     Status error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io);
-    if (error.Fail())
+    if (error.Fail() || io.piod_len == 0)
       return error;
 
-    bytes_read = io.piod_len;
+    bytes_read += io.piod_len;
     io.piod_len = size - bytes_read;
   } while (bytes_read < size);
 
@@ -723,10 +723,10 @@
     io.piod_offs = (void *)(addr + bytes_written);
 
     Status error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io);
-    if (error.Fail())
+    if (error.Fail() || io.piod_len == 0)
       return error;
 
-    bytes_written = io.piod_len;
+    bytes_written += io.piod_len;
     io.piod_len = size - bytes_written;
   } while (bytes_written < size);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61310.197326.patch
Type: text/x-patch
Size: 1012 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190430/d5bf2c51/attachment.bin>


More information about the lldb-commits mailing list