summaryrefslogtreecommitdiff
path: root/gdb/windows-nat.c
diff options
context:
space:
mode:
authorPierre Muller <muller@ics.u-strasbg.fr>2013-09-02 12:57:49 +0000
committerPierre Muller <muller@ics.u-strasbg.fr>2013-09-02 12:57:49 +0000
commit457052f916f3287e0dae259b4b8c5c2839153455 (patch)
tree9c9b28ef0eead6a7da904cc08422f88ae7b67069 /gdb/windows-nat.c
parent49ba0b8e63c5c5de77448653094468dc5111b80d (diff)
downloadgdb-457052f916f3287e0dae259b4b8c5c2839153455.tar.gz
* windows-nat.c (windows_xfer_memory): Handle ERROR_PARTIAL_COPY
error code.
Diffstat (limited to 'gdb/windows-nat.c')
-rw-r--r--gdb/windows-nat.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 28705f7fd40..a45b825ed74 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -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