aboutsummaryrefslogtreecommitdiff
path: root/gdb/rs6000-aix-tdep.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-03-08 22:28:54 -0700
committerTom Tromey <tom@tromey.com>2018-03-12 08:24:17 -0600
commit984c72381ccd9f950a87d4d7edecc6fa30db8b41 (patch)
treea47a0e379f40b237f29c9ad4fa342d93993707b8 /gdb/rs6000-aix-tdep.c
parent933522d1dbc9162fbc69453f0ab5f72998df2955 (diff)
downloadgdb-984c72381ccd9f950a87d4d7edecc6fa30db8b41.zip
gdb-984c72381ccd9f950a87d4d7edecc6fa30db8b41.tar.gz
gdb-984c72381ccd9f950a87d4d7edecc6fa30db8b41.tar.bz2
Use gdb::byte_vector when reading section data
This changes a couple of spots that read section data to use gdb::byte_vector rather than a cleanup. Regression tested by the buildbot. I am not certain that the buildbot actually tests the code in question, so I recommend careful review. gdb/ChangeLog 2018-03-12 Tom Tromey <tom@tromey.com> * rs6000-aix-tdep.c (rs6000_aix_core_xfer_shared_libraries_aix): Use gdb::byte_vector. * arm-tdep.c (arm_exidx_new_objfile): Use gdb::byte_vector.
Diffstat (limited to 'gdb/rs6000-aix-tdep.c')
-rw-r--r--gdb/rs6000-aix-tdep.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index 38c86d4..e3e086c 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -1007,9 +1007,6 @@ rs6000_aix_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch,
{
struct bfd_section *ldinfo_sec;
int ldinfo_size;
- gdb_byte *ldinfo_buf;
- struct cleanup *cleanup;
- LONGEST result;
ldinfo_sec = bfd_get_section_by_name (core_bfd, ".ldinfo");
if (ldinfo_sec == NULL)
@@ -1017,19 +1014,15 @@ rs6000_aix_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch,
bfd_errmsg (bfd_get_error ()));
ldinfo_size = bfd_get_section_size (ldinfo_sec);
- ldinfo_buf = (gdb_byte *) xmalloc (ldinfo_size);
- cleanup = make_cleanup (xfree, ldinfo_buf);
+ gdb::byte_vector ldinfo_buf (ldinfo_size);
if (! bfd_get_section_contents (core_bfd, ldinfo_sec,
- ldinfo_buf, 0, ldinfo_size))
+ ldinfo_buf.data (), 0, ldinfo_size))
error (_("unable to read .ldinfo section from core file: %s"),
bfd_errmsg (bfd_get_error ()));
- result = rs6000_aix_ld_info_to_xml (gdbarch, ldinfo_buf, readbuf,
- offset, len, 0);
-
- do_cleanups (cleanup);
- return result;
+ return rs6000_aix_ld_info_to_xml (gdbarch, ldinfo_buf.data (), readbuf,
+ offset, len, 0);
}
static void