+2016-07-01 Don Breazeal <donb@codesourcery.com>
+
+ * remote.c (remote_get_memory_xfer_limit): New function.
+ * target-delegates.c: Regenerate.
+ * target.c (memory_xfer_partial): Call
+ target_ops.to_get_memory_xfer_limit.
+ * target.h (struct target_ops) <to_get_memory_xfer_limit>: New
+ member.
+
2016-07-01 John Baldwin <jhb@FreeBSD.org>
* fbsd-nat.c (struct fbsd_fork_child_info): Rename to ...
return TARGET_XFER_OK;
}
+/* Implementation of to_get_memory_xfer_limit. */
+
+static ULONGEST
+remote_get_memory_xfer_limit (struct target_ops *ops)
+{
+ return get_memory_write_packet_size ();
+}
+
static int
remote_search_memory (struct target_ops* ops,
CORE_ADDR start_addr, ULONGEST search_space_len,
remote_ops.to_interrupt = remote_interrupt;
remote_ops.to_pass_ctrlc = remote_pass_ctrlc;
remote_ops.to_xfer_partial = remote_xfer_partial;
+ remote_ops.to_get_memory_xfer_limit = remote_get_memory_xfer_limit;
remote_ops.to_rcmd = remote_rcmd;
remote_ops.to_pid_to_exec_file = remote_pid_to_exec_file;
remote_ops.to_log_command = serial_log_command;
return result;
}
+static ULONGEST
+delegate_get_memory_xfer_limit (struct target_ops *self)
+{
+ self = self->beneath;
+ return self->to_get_memory_xfer_limit (self);
+}
+
+static ULONGEST
+tdefault_get_memory_xfer_limit (struct target_ops *self)
+{
+ return ULONGEST_MAX;
+}
+
+static ULONGEST
+debug_get_memory_xfer_limit (struct target_ops *self)
+{
+ ULONGEST result;
+ fprintf_unfiltered (gdb_stdlog, "-> %s->to_get_memory_xfer_limit (...)\n", debug_target.to_shortname);
+ result = debug_target.to_get_memory_xfer_limit (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->to_get_memory_xfer_limit (", debug_target.to_shortname);
+ target_debug_print_struct_target_ops_p (&debug_target);
+ fputs_unfiltered (") = ", gdb_stdlog);
+ target_debug_print_ULONGEST (result);
+ fputs_unfiltered ("\n", gdb_stdlog);
+ return result;
+}
+
static VEC(mem_region_s) *
delegate_memory_map (struct target_ops *self)
{
ops->to_get_thread_local_address = delegate_get_thread_local_address;
if (ops->to_xfer_partial == NULL)
ops->to_xfer_partial = delegate_xfer_partial;
+ if (ops->to_get_memory_xfer_limit == NULL)
+ ops->to_get_memory_xfer_limit = delegate_get_memory_xfer_limit;
if (ops->to_memory_map == NULL)
ops->to_memory_map = delegate_memory_map;
if (ops->to_flash_erase == NULL)
ops->to_goto_bookmark = tdefault_goto_bookmark;
ops->to_get_thread_local_address = tdefault_get_thread_local_address;
ops->to_xfer_partial = tdefault_xfer_partial;
+ ops->to_get_memory_xfer_limit = tdefault_get_memory_xfer_limit;
ops->to_memory_map = tdefault_memory_map;
ops->to_flash_erase = tdefault_flash_erase;
ops->to_flash_done = tdefault_flash_done;
ops->to_goto_bookmark = debug_goto_bookmark;
ops->to_get_thread_local_address = debug_get_thread_local_address;
ops->to_xfer_partial = debug_xfer_partial;
+ ops->to_get_memory_xfer_limit = debug_get_memory_xfer_limit;
ops->to_memory_map = debug_memory_map;
ops->to_flash_erase = debug_flash_erase;
ops->to_flash_done = debug_flash_done;
by memory_xfer_partial_1. We will continually malloc
and free a copy of the entire write request for breakpoint
shadow handling even though we only end up writing a small
- subset of it. Cap writes to 4KB to mitigate this. */
- len = min (4096, len);
+ subset of it. Cap writes to a limit specified by the target
+ to mitigate this. */
+ len = min (ops->to_get_memory_xfer_limit (ops), len);
buf = (gdb_byte *) xmalloc (len);
old_chain = make_cleanup (xfree, buf);
ULONGEST *xfered_len)
TARGET_DEFAULT_RETURN (TARGET_XFER_E_IO);
+ /* Return the limit on the size of any single memory transfer
+ for the target. */
+
+ ULONGEST (*to_get_memory_xfer_limit) (struct target_ops *)
+ TARGET_DEFAULT_RETURN (ULONGEST_MAX);
+
/* Returns the memory map for the target. A return value of NULL
means that no memory map is available. If a memory address
does not fall within any returned regions, it's assumed to be