aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-09-29 22:32:00 -0600
committerTom Tromey <tom@tromey.com>2017-10-03 05:33:47 -0600
commit0efef6405493c0bf438486819bec70b304276e16 (patch)
treeee8cb35974658aadab443dd951c074b5173ba1ab /gdb/symfile.c
parent245ad7d373aef22013b347504d30d2306da1bdbf (diff)
downloadgdb-0efef6405493c0bf438486819bec70b304276e16.zip
gdb-0efef6405493c0bf438486819bec70b304276e16.tar.gz
gdb-0efef6405493c0bf438486819bec70b304276e16.tar.bz2
Use gdb::byte_vector in load_progress
This changes load_progress to use gdb::byte_vector, removing a cleanup. 2017-10-03 Tom Tromey <tom@tromey.com> * symfile.c (load_progress): Use gdb::byte_vector.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r--gdb/symfile.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c
index f6bc378..a741654 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 <sys/types.h>
#include <fcntl.h>
@@ -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;