aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-05-27 09:27:56 -0600
committerTom Tromey <tom@tromey.com>2018-06-18 13:26:32 -0600
commit309822ca289d602b9f9baf4760329ddd08b1d204 (patch)
tree93818ea469b226ad9b0b8a8bd920d7826246aea8
parent06424eac62da949519c0c641fbc3e8372a9c7f0b (diff)
downloadgdb-309822ca289d602b9f9baf4760329ddd08b1d204.zip
gdb-309822ca289d602b9f9baf4760329ddd08b1d204.tar.gz
gdb-309822ca289d602b9f9baf4760329ddd08b1d204.tar.bz2
Use unique_xmalloc_ptr in two solib functions
This removes a couple of cleanups by using unique_xmalloc_ptr instead. These two changes are combined because the two functions are very similar. gdb/ChangeLog 2018-06-18 Tom Tromey <tom@tromey.com> * solib-frv.c (frv_relocate_main_executable): Use unique_xmalloc_ptr. * solib-dsbt.c (dsbt_relocate_main_executable): Use unique_xmalloc_ptr.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/solib-dsbt.c11
-rw-r--r--gdb/solib-frv.c11
3 files changed, 13 insertions, 16 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 553bc8a..9c83a4a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2018-06-18 Tom Tromey <tom@tromey.com>
+ * solib-frv.c (frv_relocate_main_executable): Use
+ unique_xmalloc_ptr.
+ * solib-dsbt.c (dsbt_relocate_main_executable): Use
+ unique_xmalloc_ptr.
+
+2018-06-18 Tom Tromey <tom@tromey.com>
+
* objfiles.h (inhibit_section_map_updates): Update.
(resume_section_map_updates, resume_section_map_updates_cleanup):
Remove.
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index bf643fe..4f75526 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -918,8 +918,6 @@ static void
dsbt_relocate_main_executable (void)
{
struct int_elf32_dsbt_loadmap *ldm;
- struct cleanup *old_chain;
- struct section_offsets *new_offsets;
int changed;
struct obj_section *osect;
struct dsbt_info *info = get_dsbt_info ();
@@ -931,9 +929,8 @@ dsbt_relocate_main_executable (void)
info->main_executable_lm_info = new lm_info_dsbt;
info->main_executable_lm_info->map = ldm;
- new_offsets = XCNEWVEC (struct section_offsets,
- symfile_objfile->num_sections);
- old_chain = make_cleanup (xfree, new_offsets);
+ gdb::unique_xmalloc_ptr<struct section_offsets> new_offsets
+ (XCNEWVEC (struct section_offsets, symfile_objfile->num_sections));
changed = 0;
ALL_OBJFILE_OSECTIONS (symfile_objfile, osect)
@@ -967,9 +964,7 @@ dsbt_relocate_main_executable (void)
}
if (changed)
- objfile_relocate (symfile_objfile, new_offsets);
-
- do_cleanups (old_chain);
+ objfile_relocate (symfile_objfile, new_offsets.get ());
/* Now that symfile_objfile has been relocated, we can compute the
GOT value and stash it away. */
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index e772da6..6ebc6d4 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -769,8 +769,6 @@ frv_relocate_main_executable (void)
int status;
CORE_ADDR exec_addr, interp_addr;
struct int_elf32_fdpic_loadmap *ldm;
- struct cleanup *old_chain;
- struct section_offsets *new_offsets;
int changed;
struct obj_section *osect;
@@ -792,9 +790,8 @@ frv_relocate_main_executable (void)
main_executable_lm_info = new lm_info_frv;
main_executable_lm_info->map = ldm;
- new_offsets = XCNEWVEC (struct section_offsets,
- symfile_objfile->num_sections);
- old_chain = make_cleanup (xfree, new_offsets);
+ gdb::unique_xmalloc_ptr<struct section_offsets> new_offsets
+ (XCNEWVEC (struct section_offsets, symfile_objfile->num_sections));
changed = 0;
ALL_OBJFILE_OSECTIONS (symfile_objfile, osect)
@@ -828,9 +825,7 @@ frv_relocate_main_executable (void)
}
if (changed)
- objfile_relocate (symfile_objfile, new_offsets);
-
- do_cleanups (old_chain);
+ objfile_relocate (symfile_objfile, new_offsets.get ());
/* Now that symfile_objfile has been relocated, we can compute the
GOT value and stash it away. */