From 9e86da0760aa1e52178cc5b90cd92a7cd4a338f9 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 11 Oct 2017 14:43:57 -0600 Subject: 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 * 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. --- gdb/jit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gdb/jit.c') diff --git a/gdb/jit.c b/gdb/jit.c index c19d352..556bcb6 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -801,8 +801,8 @@ jit_object_close_impl (struct gdb_symbol_callbacks *cb, priv_data = (jit_dbg_reader_data *) cb->priv_data; - objfile = allocate_objfile (NULL, "<< JIT compiled code >>", - OBJF_NOT_FILENAME); + objfile = new struct objfile (NULL, "<< JIT compiled code >>", + OBJF_NOT_FILENAME); objfile->per_bfd->gdbarch = target_gdbarch (); terminate_minimal_symbol_table (objfile); @@ -983,7 +983,7 @@ jit_register_code (struct gdbarch *gdbarch, static void jit_unregister_code (struct objfile *objfile) { - free_objfile (objfile); + delete objfile; } /* Look up the objfile with this code entry address. */ -- cgit v1.1