diff options
Diffstat (limited to 'gdb/corefile.c')
-rw-r--r-- | gdb/corefile.c | 8 |
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); } |