[FYI] Use gdb::byte_vector in target_write_memory

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[FYI] Use gdb::byte_vector in target_write_memory

Tom Tromey-4
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  <[hidden email]>

        * 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