From: Tom Tromey Date: Sat, 30 Sep 2017 04:32:00 +0000 (-0600) Subject: Use gdb::byte_vector in load_progress X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0efef6405493c0bf438486819bec70b304276e16;p=binutils-gdb.git Use gdb::byte_vector in load_progress This changes load_progress to use gdb::byte_vector, removing a cleanup. 2017-10-03 Tom Tromey * symfile.c (load_progress): Use gdb::byte_vector. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 35c7e3cc629..d5ba3984213 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2017-10-03 Tom Tromey + + * symfile.c (load_progress): Use gdb::byte_vector. + 2017-10-03 Tom Tromey * mi/mi-main.c (mi_cmd_trace_frame_collected): Remove unused diff --git a/gdb/symfile.c b/gdb/symfile.c index f6bc378a0df..a74165456e8 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -56,6 +56,7 @@ #include "stack.h" #include "gdb_bfd.h" #include "cli/cli-utils.h" +#include "common/byte-vector.h" #include #include @@ -1942,16 +1943,14 @@ load_progress (ULONGEST bytes, void *untyped_arg) might add a verify_memory() method to the target vector and then use that. remote.c could implement that method using the ``qCRC'' packet. */ - gdb_byte *check = (gdb_byte *) xmalloc (bytes); - struct cleanup *verify_cleanups = make_cleanup (xfree, check); + gdb::byte_vector check (bytes); - if (target_read_memory (args->lma, check, bytes) != 0) + if (target_read_memory (args->lma, check.data (), bytes) != 0) error (_("Download verify read failed at %s"), paddress (target_gdbarch (), args->lma)); - if (memcmp (args->buffer, check, bytes) != 0) + if (memcmp (args->buffer, check.data (), bytes) != 0) error (_("Download verify compare failed at %s"), paddress (target_gdbarch (), args->lma)); - do_cleanups (verify_cleanups); } totals->data_count += bytes; args->lma += bytes;