From: dje@google.com (Doug Evans)
To: gdb-patches@sourceware.org
Subject: [RFA] remove unnecessary alloca/memcpy in write_memory
Date: Wed, 06 Aug 2008 04:48:00 -0000 [thread overview]
Message-ID: <20080806044718.E1D301C77BE@localhost> (raw)
Hi. Any ideas why the call to alloca/memcpy?
[Why not pass myaddr to target_write_memory directly?]
void
write_memory (CORE_ADDR memaddr, const bfd_byte *myaddr, int len)
{
int status;
gdb_byte *bytes = alloca (len);
memcpy (bytes, myaddr, len);
status = target_write_memory (memaddr, bytes, len);
if (status != 0)
memory_error (status, memaddr);
}
2008-08-05 Doug Evans <dje@google.com>
* corefile.c (write_memory): Remove unnecessary copying.
Index: corefile.c
===================================================================
RCS file: /cvs/src/src/gdb/corefile.c,v
retrieving revision 1.44
diff -u -p -u -p -r1.44 corefile.c
--- corefile.c 30 Apr 2008 18:22:37 -0000 1.44
+++ corefile.c 6 Aug 2008 04:45:25 -0000
@@ -350,10 +350,7 @@ void
write_memory (CORE_ADDR memaddr, const bfd_byte *myaddr, int len)
{
int status;
- gdb_byte *bytes = alloca (len);
-
- memcpy (bytes, myaddr, len);
- status = target_write_memory (memaddr, bytes, len);
+ status = target_write_memory (memaddr, myaddr, len);
if (status != 0)
memory_error (status, memaddr);
}
next reply other threads:[~2008-08-06 4:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-06 4:48 Doug Evans [this message]
2008-08-06 11:26 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080806044718.E1D301C77BE@localhost \
--to=dje@google.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox