aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
authorPierre Muller <muller@sourceware.org>2013-09-02 14:32:19 +0000
committerPierre Muller <muller@sourceware.org>2013-09-02 14:32:19 +0000
commitcee83bcb4927035bcdc60a9e3daba2e1ee8eb0f0 (patch)
treefedb9ffbe69612fb4dfb41bcd13773929f6509d2 /gdb/gdbserver
parent9a13b2fa01990ef21856bba455fdd39d5d81eb5f (diff)
downloadgdb-cee83bcb4927035bcdc60a9e3daba2e1ee8eb0f0.zip
gdb-cee83bcb4927035bcdc60a9e3daba2e1ee8eb0f0.tar.gz
gdb-cee83bcb4927035bcdc60a9e3daba2e1ee8eb0f0.tar.bz2
* win32-low.c (child_xfer_memory): Check if ReadProcessMemory
or WriteProcessMemory complete successfully and handle ERROR_PARTIAL_COPY error.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog6
-rw-r--r--gdb/gdbserver/win32-low.c21
2 files changed, 21 insertions, 6 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 1e15f77..54348e5 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,9 @@
+2013-09-02 Pierre Muller <muller@sourceware.org>
+
+ * win32-low.c (child_xfer_memory): Check if ReadProcessMemory
+ or WriteProcessMemory complete successfully and handle
+ ERROR_PARTIAL_COPY error.
+
2013-09-02 Pedro Alves <palves@redhat.com>
* server.c (gdb_read_memory): Return -1 on traceframe memory read
diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c
index 4e87a43..549c29f 100644
--- a/gdb/gdbserver/win32-low.c
+++ b/gdb/gdbserver/win32-low.c
@@ -278,21 +278,30 @@ static int
child_xfer_memory (CORE_ADDR memaddr, char *our, int len,
int write, struct target_ops *target)
{
- SIZE_T done;
+ BOOL success;
+ SIZE_T done = 0;
+ DWORD lasterror = 0;
uintptr_t addr = (uintptr_t) memaddr;
if (write)
{
- WriteProcessMemory (current_process_handle, (LPVOID) addr,
- (LPCVOID) our, len, &done);
+ success = WriteProcessMemory (current_process_handle, (LPVOID) addr,
+ (LPCVOID) our, len, &done);
+ if (!success)
+ lasterror = GetLastError ();
FlushInstructionCache (current_process_handle, (LPCVOID) addr, len);
}
else
{
- ReadProcessMemory (current_process_handle, (LPCVOID) addr, (LPVOID) our,
- len, &done);
+ success = ReadProcessMemory (current_process_handle, (LPCVOID) addr,
+ (LPVOID) our, len, &done);
+ if (!success)
+ lasterror = GetLastError ();
}
- return done;
+ if (!success && lasterror == ERROR_PARTIAL_COPY && done > 0)
+ return done;
+ else
+ return success ? done : -1;
}
/* Clear out any old thread list and reinitialize it to a pristine