Re: [commit] Tighten memory read/write methods

Mark Kettenis
2005-01-27T21:05:00Z

Date: Thu, 27 Jan 2005 15:11:19 -0500
From: Andrew Cagney <cagney@gnu.org>

Index: corefile.c
===================================================================
RCS file: /cvs/src/src/gdb/corefile.c,v
retrieving revision 1.28
diff -p -u -r1.28 corefile.c
--- corefile.c 13 Jan 2005 23:56:25 -0000 1.28
+++ corefile.c 27 Jan 2005 20:07:21 -0000
@@ -347,11 +347,13 @@ read_memory_typed_address (CORE_ADDR add

/* 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);
}

Is this addiotional copy really necessary now that you've properly
consified target_write_memory?

Mark