aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog11
-rw-r--r--gdb/remote.c46
-rw-r--r--gdb/remote.h3
3 files changed, 37 insertions, 23 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 38ffcab..4dfbd9b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,14 @@
+2006-08-15 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * remote.c (remote_write_bytes): Take a const buffer argument.
+ Do the checks from remote_xfer_memory.
+ (remote_read_bytes): Do the checks from remote_xfer_memory.
+ (remote_xfer_memory): Remove checks pushed into lower level
+ functions.
+ (remote_xfer_partial): Call remote_write_bytes and remote_read_bytes
+ directly.
+ * remote.h (remote_write_bytes): Update prototype.
+
2006-08-11 Andrew Stubbs <andrew.stubbs@st.com>
* NEWS: Add 'set trace-commands' command.
diff --git a/gdb/remote.c b/gdb/remote.c
index adafdc7..6545094 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -3853,7 +3853,7 @@ check_binary_download (CORE_ADDR addr)
error. Only transfer a single packet. */
int
-remote_write_bytes (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
+remote_write_bytes (CORE_ADDR memaddr, const gdb_byte *myaddr, int len)
{
struct remote_state *rs = get_remote_state ();
char *buf;
@@ -3865,6 +3865,15 @@ remote_write_bytes (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
int payload_size;
int payload_length;
+ /* Should this be the selected frame? */
+ gdbarch_remote_translate_xfer_address (current_gdbarch,
+ current_regcache,
+ memaddr, len,
+ &memaddr, &len);
+
+ if (len <= 0)
+ return 0;
+
/* Verify that the target can support a binary download. */
check_binary_download (memaddr);
@@ -4023,6 +4032,15 @@ remote_read_bytes (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
int max_buf_size; /* Max size of packet output buffer. */
int origlen;
+ /* Should this be the selected frame? */
+ gdbarch_remote_translate_xfer_address (current_gdbarch,
+ current_regcache,
+ memaddr, len,
+ &memaddr, &len);
+
+ if (len <= 0)
+ return 0;
+
max_buf_size = get_memory_read_packet_size ();
/* The packet buffer will be large enough for the payload;
get_memory_packet_size ensures this. */
@@ -4090,22 +4108,12 @@ remote_xfer_memory (CORE_ADDR mem_addr, gdb_byte *buffer, int mem_len,
int should_write, struct mem_attrib *attrib,
struct target_ops *target)
{
- CORE_ADDR targ_addr;
- int targ_len;
int res;
- /* Should this be the selected frame? */
- gdbarch_remote_translate_xfer_address (current_gdbarch,
- current_regcache,
- mem_addr, mem_len,
- &targ_addr, &targ_len);
- if (targ_len <= 0)
- return 0;
-
if (should_write)
- res = remote_write_bytes (targ_addr, buffer, targ_len);
+ res = remote_write_bytes (mem_addr, buffer, mem_len);
else
- res = remote_read_bytes (targ_addr, buffer, targ_len);
+ res = remote_read_bytes (mem_addr, buffer, mem_len);
return res;
}
@@ -5270,22 +5278,16 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
char *p2;
char query_type;
- /* Handle memory using remote_xfer_memory. */
+ /* Handle memory using the standard memory routines. */
if (object == TARGET_OBJECT_MEMORY)
{
int xfered;
errno = 0;
if (writebuf != NULL)
- {
- void *buffer = xmalloc (len);
- struct cleanup *cleanup = make_cleanup (xfree, buffer);
- memcpy (buffer, writebuf, len);
- xfered = remote_xfer_memory (offset, buffer, len, 1, NULL, ops);
- do_cleanups (cleanup);
- }
+ xfered = remote_write_bytes (offset, writebuf, len);
else
- xfered = remote_xfer_memory (offset, readbuf, len, 0, NULL, ops);
+ xfered = remote_read_bytes (offset, readbuf, len);
if (xfered > 0)
return xfered;
diff --git a/gdb/remote.h b/gdb/remote.h
index c715e58..fd84a91 100644
--- a/gdb/remote.h
+++ b/gdb/remote.h
@@ -55,7 +55,8 @@ extern void remote_cisco_objfile_relocate (bfd_signed_vma text_off,
extern void async_remote_interrupt_twice (void *arg);
-extern int remote_write_bytes (CORE_ADDR memaddr, gdb_byte *myaddr, int len);
+extern int remote_write_bytes (CORE_ADDR memaddr, const gdb_byte *myaddr,
+ int len);
extern int remote_read_bytes (CORE_ADDR memaddr, gdb_byte *myaddr, int len);