From 9e52adf9c624da6ad0c37861c2222bd7fd9a8d2c Mon Sep 17 00:00:00 2001 From: Pierre Muller Date: Mon, 2 Sep 2013 12:57:49 +0000 Subject: [PATCH] * windows-nat.c (windows_xfer_memory): Handle ERROR_PARTIAL_COPY error code. --- gdb/ChangeLog | 5 +++++ gdb/windows-nat.c | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0622214..bb17a56 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2013-09-02 Pierre Muller + * windows-nat.c (windows_xfer_memory): Handle ERROR_PARTIAL_COPY + error code. + +2013-09-02 Pierre Muller + * windows-nat.c (windows_xfer_memory): Fix compilation failure by use of plongest function. diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 28705f7..a45b825 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 -- 2.7.4