2005-01-27 Andrew Cagney <cagney@gnu.org>
[external/binutils.git] / gdb / corefile.c
index 8ef3ed2..ff7003a 100644 (file)
@@ -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);
 }