* windows-nat.c (windows_xfer_memory): Handle ERROR_PARTIAL_COPY
authorPierre Muller <muller@sourceware.org>
Mon, 2 Sep 2013 12:57:49 +0000 (12:57 +0000)
committerPierre Muller <muller@sourceware.org>
Mon, 2 Sep 2013 12:57:49 +0000 (12:57 +0000)
error code.

gdb/ChangeLog
gdb/windows-nat.c

index 0622214370bdcfa986095335dd95c48b9deadae8..bb17a56924469e47f579b882909850dea27b793d 100644 (file)
@@ -1,3 +1,8 @@
+2013-09-02  Pierre Muller  <muller@sourceware.org>
+
+       * windows-nat.c (windows_xfer_memory): Handle ERROR_PARTIAL_COPY
+       error code.
+
 2013-09-02  Pierre Muller  <muller@sourceware.org>
 
        * windows-nat.c (windows_xfer_memory): Fix compilation failure
index 28705f7fd40f10546029e8206d1e659d3f274ec9..a45b825ed74f58735a14dfff1905d0ae5916e5e1 100644 (file)
@@ -2324,6 +2324,7 @@ windows_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
 {
   SIZE_T done = 0;
   BOOL success;
+  DWORD lasterror = 0;
 
   if (writebuf != NULL)
     {
@@ -2332,6 +2333,8 @@ windows_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
       success = WriteProcessMemory (current_process_handle,
                                    (LPVOID) (uintptr_t) memaddr, writebuf,
                                    len, &done);
+      if (!success)
+       lasterror = GetLastError ();
       FlushInstructionCache (current_process_handle,
                             (LPCVOID) (uintptr_t) memaddr, len);
     }
@@ -2342,8 +2345,13 @@ windows_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
       success = ReadProcessMemory (current_process_handle,
                                   (LPCVOID) (uintptr_t) memaddr, readbuf,
                                   len, &done);
+      if (!success)
+       lasterror = GetLastError ();
     }
-  return success ? done : TARGET_XFER_E_IO;
+  if (!success && lasterror == ERROR_PARTIAL_COPY && done > 0)
+    return done;
+  else
+    return success ? done : TARGET_XFER_E_IO;
 }
 
 static void
This page took 0.030695 seconds and 4 git commands to generate.