aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-10-11 14:43:57 -0600
committerTom Tromey <tom@tromey.com>2017-10-13 07:18:29 -0600
commit9e86da0760aa1e52178cc5b90cd92a7cd4a338f9 (patch)
treeb191db49800f615613b4de6ff94e095f0fa48421 /gdb/solib.c
parent7594f6236073fcc8696c43e1f5267e61f7d5c226 (diff)
downloadbinutils-9e86da0760aa1e52178cc5b90cd92a7cd4a338f9.zip
binutils-9e86da0760aa1e52178cc5b90cd92a7cd4a338f9.tar.gz
binutils-9e86da0760aa1e52178cc5b90cd92a7cd4a338f9.tar.bz2
Change objfile to use new/delete
This changes objfiles to use new and delete rather than xmalloc and free. Simon noticed that it uses a non-POD and so shouldn't be allocated with XCNEW; and I wanted to be able to use another non-POD as a member; this patch is the result. Regression tested by the buildbot. 2017-10-13 Tom Tromey <tom@tromey.com> * compile/compile-object-run.c (do_module_cleanup): Use delete. * solib.c (update_solib_list, reload_shared_libraries_1): Use delete. * symfile.c (symbol_file_add_with_addrs): Use new. (symbol_file_add_separate): Update comment. (syms_from_objfile_1, remove_symbol_file_command): Use delete. * jit.c (jit_object_close_impl): Use new. (jit_unregister_code): Use delete. * objfiles.c (objfile::objfile): Rename from allocate_objfile. (~objfile): Rename from free_objfile. (free_objfile_separate_debug, do_free_objfile_cleanup) (free_all_objfiles, objfile_purge_solibs): Use delete. * objfiles.h (struct objfile): Add constructor and destructor. Use DISABLE_COPY_AND_ASSIGN. Add initializers to data members. (allocate_objfile, free_objfile): Don't declare. (struct objstats): Add initializers.
Diffstat (limited to 'gdb/solib.c')
-rw-r--r--gdb/solib.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/solib.c b/gdb/solib.c
index e605e6b..f9f7217 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -851,7 +851,7 @@ update_solib_list (int from_tty)
/* Unless the user loaded it explicitly, free SO's objfile. */
if (gdb->objfile && ! (gdb->objfile->flags & OBJF_USERLOADED)
&& !solib_used (gdb))
- free_objfile (gdb->objfile);
+ delete gdb->objfile;
/* Some targets' section tables might be referring to
sections from so->abfd; remove them. */
@@ -1334,7 +1334,7 @@ reload_shared_libraries_1 (int from_tty)
{
if (so->objfile && ! (so->objfile->flags & OBJF_USERLOADED)
&& !solib_used (so))
- free_objfile (so->objfile);
+ delete so->objfile;
remove_target_sections (so);
clear_so (so);
}