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;
#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);
/* 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;
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);
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
}
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. */
}
}
static void
-windows_close (void)
+windows_close (struct target_ops *self)
{
DEBUG_EVENTS (("gdb: windows_close, inferior_ptid=%d\n",
ptid_get_pid (inferior_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;
struct so_list *so;
if (writebuf)
- return -1;
+ return TARGET_XFER_E_IO;
obstack_init (&obstack);
obstack_grow_str (&obstack, "<library-list>\n");
}
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;
}
}