aboutsummaryrefslogtreecommitdiff
path: root/gdb/sparc64-tdep.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-11-01 16:37:27 -0600
committerTom Tromey <tom@tromey.com>2017-11-04 10:27:17 -0600
commit7f6743fd09d0f3188dd9dcdf31acf81131f9bf1f (patch)
tree6b3a55a30cce596bc802f3629d53360247b521d0 /gdb/sparc64-tdep.c
parentc80049d3b615691dc902762d5d97551aa9664442 (diff)
downloadgdb-7f6743fd09d0f3188dd9dcdf31acf81131f9bf1f.zip
gdb-7f6743fd09d0f3188dd9dcdf31acf81131f9bf1f.tar.gz
gdb-7f6743fd09d0f3188dd9dcdf31acf81131f9bf1f.tar.bz2
Use gdb::def_vector in sparc64-tdep.c
This removes a cleanup from sparc64-tdep.c, replacing it with gdb::def_vector. gdb/ChangeLog 2017-11-04 Tom Tromey <tom@tromey.com> * sparc64-tdep.c (do_examine): Use gdb::def_vector. (adi_read_versions): Change "tags" to "gdb_byte *". (adi_print_versions): Likewise.
Diffstat (limited to 'gdb/sparc64-tdep.c')
-rw-r--r--gdb/sparc64-tdep.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index a756834..eade046 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -341,7 +341,7 @@ adi_is_addr_mapped (CORE_ADDR vaddr, size_t cnt)
for "SIZE" number of bytes. */
static int
-adi_read_versions (CORE_ADDR vaddr, size_t size, unsigned char *tags)
+adi_read_versions (CORE_ADDR vaddr, size_t size, gdb_byte *tags)
{
int fd = adi_tag_fd ();
if (fd == -1)
@@ -383,7 +383,7 @@ adi_write_versions (CORE_ADDR vaddr, size_t size, unsigned char *tags)
at "VADDR" with number of "CNT". */
static void
-adi_print_versions (CORE_ADDR vaddr, size_t cnt, unsigned char *tags)
+adi_print_versions (CORE_ADDR vaddr, size_t cnt, gdb_byte *tags)
{
int v_idx = 0;
const int maxelts = 8; /* # of elements per line */
@@ -415,21 +415,17 @@ static void
do_examine (CORE_ADDR start, int bcnt)
{
CORE_ADDR vaddr = adi_normalize_address (start);
- struct cleanup *cleanup;
CORE_ADDR vstart = adi_align_address (vaddr);
int cnt = adi_convert_byte_count (vaddr, bcnt, vstart);
- unsigned char *buf = (unsigned char *) xmalloc (cnt);
- cleanup = make_cleanup (xfree, buf);
- int read_cnt = adi_read_versions (vstart, cnt, buf);
+ gdb::def_vector<gdb_byte> buf (cnt);
+ int read_cnt = adi_read_versions (vstart, cnt, buf.data ());
if (read_cnt == -1)
error (_("No ADI information"));
else if (read_cnt < cnt)
error(_("No ADI information at %s"), paddress (target_gdbarch (), vaddr));
- adi_print_versions (vstart, cnt, buf);
-
- do_cleanups (cleanup);
+ adi_print_versions (vstart, cnt, buf.data ());
}
static void