public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [FYI] Use gdb::byte_vector in target_write_memory
Date: Thu, 15 Aug 2019 17:23:00 -0000	[thread overview]
Message-ID: <20190815172346.26885-1-tromey@adacore.com> (raw)

Pedro pointed out that target_write_memory should use gdb::byte_vector
rather than std::vector<unsigned char>.

gdb/gdbserver/ChangeLog
2019-08-15  Tom Tromey  <tromey@adacore.com>

	* target.c (target_write_memory): Use gdb::byte_vector.
---
 gdb/gdbserver/ChangeLog | 4 ++++
 gdb/gdbserver/target.c  | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c
index 6f6b448ecf4..0b45b6c956d 100644
--- a/gdb/gdbserver/target.c
+++ b/gdb/gdbserver/target.c
@@ -20,6 +20,7 @@
 
 #include "server.h"
 #include "tracepoint.h"
+#include "gdbsupport/byte-vector.h"
 
 struct target_ops *the_target;
 
@@ -154,7 +155,7 @@ target_write_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
 {
   /* Make a copy of the data because check_mem_write may need to
      update it.  */
-  std::vector<unsigned char> buffer (myaddr, myaddr + len);
+  gdb::byte_vector buffer (myaddr, myaddr + len);
   check_mem_write (memaddr, buffer.data (), myaddr, len);
   return (*the_target->write_memory) (memaddr, buffer.data (), len);
 }
-- 
2.20.1

                 reply	other threads:[~2019-08-15 17:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20190815172346.26885-1-tromey@adacore.com \
    --to=tromey@adacore.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).