X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fwindows-nat.c;h=9212adfefd2fdc349e8b46bda294f193e7e2d863;hb=9f1b45b0da430a7a7abf9e54acbe6f2ef9d3a763;hp=b57adaa4d49a9a699b4ddd95531cd2ece30cc461;hpb=ecd75fc8eed3bde86036141228074a20e55dcfc9;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index b57adaa4d4..9212adfefd 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -43,7 +43,6 @@ #include #include #endif -#include #include "buildsym.h" #include "filenames.h" @@ -342,7 +341,7 @@ windows_add_thread (ptid_t ptid, HANDLE h, void *tlb) if ((th = thread_rec (id, FALSE))) return th; - th = XZALLOC (thread_info); + th = XCNEW (thread_info); th->id = id; th->h = h; th->thread_local_base = (CORE_ADDR) (uintptr_t) tlb; @@ -729,7 +728,7 @@ windows_make_so (const char *name, LPVOID load_addr) #endif } #endif - so = XZALLOC (struct so_list); + so = XCNEW (struct so_list); so->lm_info = (struct lm_info *) xmalloc (sizeof (struct lm_info)); so->lm_info->load_addr = load_addr; strcpy (so->so_original_name, name); @@ -2414,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; @@ -2425,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); @@ -2437,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 @@ -2469,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. */ } @@ -2503,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; @@ -2515,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"); @@ -2537,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; } }