diff options
author | Pedro Alves <palves@redhat.com> | 2014-02-26 14:36:03 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2014-02-26 14:37:14 +0000 |
commit | a1583b1fd9aee80f886e8cdd90e1c7e27c5cbbc7 (patch) | |
tree | 405d6994a4ffbcac53f07444c30564cad3641083 /gdb | |
parent | 6df1b29f02837669d68b8f153b189502e798a302 (diff) | |
download | gdb-a1583b1fd9aee80f886e8cdd90e1c7e27c5cbbc7.zip gdb-a1583b1fd9aee80f886e8cdd90e1c7e27c5cbbc7.tar.gz gdb-a1583b1fd9aee80f886e8cdd90e1c7e27c5cbbc7.tar.bz2 |
remote-m32r-sdi.c: Don't install a deprecated_xfer_memory method
This removes yet another instance of a deprecated_xfer_memory user.
Tested by building a --enable-targets=all gdb, on x86-64 Fedora 17.
gdb/
2014-02-26 Pedro Alves <palves@redhat.com>
* remote-m32r-sdi.c (send_data): Constify 'buf' parameter.
(m32r_xfer_memory): Adjust as a to_xfer_partial helper.
(m32r_xfer_partial): New function.
(init_m32r_ops): Don't install a deprecated_xfer_memory hook.
Install a to_xfer_partial hook.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/remote-m32r-sdi.c | 60 |
2 files changed, 50 insertions, 18 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 821ec53..44e2656 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2014-02-26 Pedro Alves <palves@redhat.com> + * remote-m32r-sdi.c (send_data): Constify 'buf' parameter. + (m32r_xfer_memory): Adjust as a to_xfer_partial helper. + (m32r_xfer_partial): New function. + (init_m32r_ops): Don't install a deprecated_xfer_memory hook. + Install a to_xfer_partial hook. + +2014-02-26 Pedro Alves <palves@redhat.com> + * remote-mips.c (mips_xfer_memory): Adjust as to_xfer_partial helper. (mips_xfer_partial): New function. diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index 02a812a..0c23403 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -179,7 +179,7 @@ get_ack (void) /* Send data to the target and check an ack packet. */ static int -send_data (void *buf, int len) +send_data (const void *buf, int len) { if (!sdi_desc) return -1; @@ -1032,11 +1032,12 @@ m32r_files_info (struct target_ops *target) } } -/* Read/Write memory. */ -static int -m32r_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, - int write, - struct mem_attrib *attrib, struct target_ops *target) +/* Helper for m32r_xfer_partial that handles memory transfers. + Arguments are like target_xfer_partial. */ + +static enum target_xfer_status +m32r_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf, + ULONGEST memaddr, ULONGEST len, ULONGEST *xfered_len) { unsigned long taddr; unsigned char buf[0x2000]; @@ -1052,22 +1053,24 @@ m32r_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, if (remote_debug) { - if (write) - fprintf_unfiltered (gdb_stdlog, "m32r_xfer_memory(%s,%d,write)\n", - paddress (target_gdbarch (), memaddr), len); + if (writebuf != NULL) + fprintf_unfiltered (gdb_stdlog, "m32r_xfer_memory(%s,%s,write)\n", + paddress (target_gdbarch (), memaddr), + plongest (len)); else - fprintf_unfiltered (gdb_stdlog, "m32r_xfer_memory(%s,%d,read)\n", - paddress (target_gdbarch (), memaddr), len); + fprintf_unfiltered (gdb_stdlog, "m32r_xfer_memory(%s,%s,read)\n", + paddress (target_gdbarch (), memaddr), + plongest (len)); } - if (write) + if (writebuf != NULL) { buf[0] = SDI_WRITE_MEMORY; store_long_parameter (buf + 1, taddr); store_long_parameter (buf + 5, len); if (len < 0x1000) { - memcpy (buf + 9, myaddr, len); + memcpy (buf + 9, writebuf, len); ret = send_data (buf, len + 9) - 9; } else @@ -1079,7 +1082,7 @@ m32r_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, "m32r_xfer_memory() failed\n"); return 0; } - ret = send_data (myaddr, len); + ret = send_data (writebuf, len); } } else @@ -1102,17 +1105,38 @@ m32r_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, return 0; } - ret = recv_data (myaddr, len); + ret = recv_data (readbuf, len); } if (ret <= 0) { if (remote_debug) fprintf_unfiltered (gdb_stdlog, "m32r_xfer_memory() fails\n"); - return 0; + return TARGET_XFER_E_IO; } - return ret; + *xfered_len = ret; + return TARGET_XFER_OK; +} + +/* Target to_xfer_partial implementation. */ + +static enum target_xfer_status +m32r_xfer_partial (struct target_ops *ops, enum target_object object, + const char *annex, gdb_byte *readbuf, + const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, + ULONGEST *xfered_len) +{ + switch (object) + { + case TARGET_OBJECT_MEMORY: + return m32r_xfer_memory (readbuf, writebuf, offset, len, xfered_len); + + default: + return ops->beneath->to_xfer_partial (ops->beneath, object, annex, + readbuf, writebuf, offset, len, + xfered_len); + } } static void @@ -1635,7 +1659,7 @@ init_m32r_ops (void) m32r_ops.to_fetch_registers = m32r_fetch_register; m32r_ops.to_store_registers = m32r_store_register; m32r_ops.to_prepare_to_store = m32r_prepare_to_store; - m32r_ops.deprecated_xfer_memory = m32r_xfer_memory; + m32r_ops.to_xfer_partial = m32r_xfer_partial; m32r_ops.to_files_info = m32r_files_info; m32r_ops.to_insert_breakpoint = m32r_insert_breakpoint; m32r_ops.to_remove_breakpoint = m32r_remove_breakpoint; |