summaryrefslogtreecommitdiff
path: root/gdb/corefile.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2005-01-27 20:09:10 +0000
committerAndrew Cagney <cagney@redhat.com>2005-01-27 20:09:10 +0000
commitf513ad404791d9f7d79f80bf189041b1ab4e5f46 (patch)
tree6f07d7834cc99b1035ebbd668af491d78b37cf9c /gdb/corefile.c
parent2eb2d38fe7efad53a56e5a6a0413bc0b440df5d4 (diff)
downloadgdb-f513ad404791d9f7d79f80bf189041b1ab4e5f46.tar.gz
2005-01-27 Andrew Cagney <cagney@gnu.org>
* symfile-mem.c (do_target_read_memory): New function. (symbol_file_add_from_memory): Pass do_target_read_memory to bfd_elf_bfd_from_remote_memory. * corefile.c (write_memory): Update, make a copy of the read-only buffer. * target.c (target_read_memory): Update. (target_write_memory): Update, make a copy of the read-only buffer. * gdbcore.h (write_memory): Change buffer type to bfd_byte, make const. * target.h (target_read_memory, target_write_memory): Change buffer type to bfd_byte; for write_memory, make it const.
Diffstat (limited to 'gdb/corefile.c')
-rw-r--r--gdb/corefile.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gdb/corefile.c b/gdb/corefile.c
index 8ef3ed2ef76..ff7003aaa88 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -347,11 +347,13 @@ read_memory_typed_address (CORE_ADDR addr, struct type *type)
/* Same as target_write_memory, but report an error if can't write. */
void
-write_memory (CORE_ADDR memaddr, char *myaddr, int len)
+write_memory (CORE_ADDR memaddr, const bfd_byte *myaddr, int len)
{
int status;
-
- status = target_write_memory (memaddr, myaddr, len);
+ bfd_byte *bytes = alloca (len);
+
+ memcpy (bytes, myaddr, len);
+ status = target_write_memory (memaddr, bytes, len);
if (status != 0)
memory_error (status, memaddr);
}