X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fwindows-nat.c;h=9212adfefd2fdc349e8b46bda294f193e7e2d863;hb=9f1b45b0da430a7a7abf9e54acbe6f2ef9d3a763;hp=b42e5df1557a1f9509fa4afad085d64c00204a89;hpb=41bf6acad7b02f67240f4cf84f066078f9ed7116;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index b42e5df155..9212adfefd 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -2413,9 +2413,9 @@ windows_stop (ptid_t ptid) /* Helper for windows_xfer_partial that handles memory transfers. Arguments are like target_xfer_partial. */ -static LONGEST +static enum target_xfer_status windows_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf, - ULONGEST memaddr, LONGEST len) + ULONGEST memaddr, ULONGEST len, ULONGEST *xfered_len) { SIZE_T done = 0; BOOL success; @@ -2424,7 +2424,7 @@ windows_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf, if (writebuf != NULL) { DEBUG_MEM (("gdb: write target memory, %s bytes at %s\n", - plongest (len), core_addr_to_string (memaddr))); + pulongest (len), core_addr_to_string (memaddr))); success = WriteProcessMemory (current_process_handle, (LPVOID) (uintptr_t) memaddr, writebuf, len, &done); @@ -2436,17 +2436,18 @@ windows_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf, else { DEBUG_MEM (("gdb: read target memory, %s bytes at %s\n", - plongest (len), core_addr_to_string (memaddr))); + pulongest (len), core_addr_to_string (memaddr))); success = ReadProcessMemory (current_process_handle, (LPCVOID) (uintptr_t) memaddr, readbuf, len, &done); if (!success) lasterror = GetLastError (); } + *xfered_len = (ULONGEST) done; if (!success && lasterror == ERROR_PARTIAL_COPY && done > 0) - return done; + return TARGET_XFER_OK; else - return success ? done : TARGET_XFER_E_IO; + return success ? TARGET_XFER_OK : TARGET_XFER_E_IO; } static void @@ -2468,7 +2469,7 @@ windows_kill_inferior (struct target_ops *ops) } static void -windows_prepare_to_store (struct regcache *regcache) +windows_prepare_to_store (struct target_ops *self, struct regcache *regcache) { /* Do nothing, since we can store individual regs. */ } @@ -2502,11 +2503,12 @@ windows_pid_to_str (struct target_ops *ops, ptid_t ptid) return normal_pid_to_str (ptid); } -static LONGEST +static enum target_xfer_status windows_xfer_shared_libraries (struct target_ops *ops, - enum target_object object, const char *annex, - gdb_byte *readbuf, const gdb_byte *writebuf, - ULONGEST offset, LONGEST len) + enum target_object object, const char *annex, + gdb_byte *readbuf, const gdb_byte *writebuf, + ULONGEST offset, ULONGEST len, + ULONGEST *xfered_len) { struct obstack obstack; const char *buf; @@ -2514,7 +2516,7 @@ windows_xfer_shared_libraries (struct target_ops *ops, struct so_list *so; if (writebuf) - return -1; + return TARGET_XFER_E_IO; obstack_init (&obstack); obstack_grow_str (&obstack, "\n"); @@ -2536,28 +2538,31 @@ windows_xfer_shared_libraries (struct target_ops *ops, } obstack_free (&obstack, NULL); - return len; + *xfered_len = (ULONGEST) len; + return TARGET_XFER_OK; } -static LONGEST +static enum target_xfer_status windows_xfer_partial (struct target_ops *ops, enum target_object object, - const char *annex, gdb_byte *readbuf, - const gdb_byte *writebuf, ULONGEST offset, LONGEST len) + const char *annex, gdb_byte *readbuf, + const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, + ULONGEST *xfered_len) { switch (object) { case TARGET_OBJECT_MEMORY: - return windows_xfer_memory (readbuf, writebuf, offset, len); + return windows_xfer_memory (readbuf, writebuf, offset, len, xfered_len); case TARGET_OBJECT_LIBRARIES: return windows_xfer_shared_libraries (ops, object, annex, readbuf, - writebuf, offset, len); + writebuf, offset, len, xfered_len); default: if (ops->beneath != NULL) return ops->beneath->to_xfer_partial (ops->beneath, object, annex, - readbuf, writebuf, offset, len); - return -1; + readbuf, writebuf, offset, len, + xfered_len); + return TARGET_XFER_E_IO; } }