diff options
author | Tom Tromey <tom@tromey.com> | 2017-10-11 14:43:57 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-10-13 07:18:29 -0600 |
commit | 9e86da0760aa1e52178cc5b90cd92a7cd4a338f9 (patch) | |
tree | b191db49800f615613b4de6ff94e095f0fa48421 /gdb/symfile.c | |
parent | 7594f6236073fcc8696c43e1f5267e61f7d5c226 (diff) | |
download | gdb-9e86da0760aa1e52178cc5b90cd92a7cd4a338f9.zip gdb-9e86da0760aa1e52178cc5b90cd92a7cd4a338f9.tar.gz gdb-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/symfile.c')
-rw-r--r-- | gdb/symfile.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c index c69a474..07d867c 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1018,7 +1018,7 @@ syms_from_objfile_1 (struct objfile *objfile, if (symfile_objfile != NULL) { - free_objfile (symfile_objfile); + delete symfile_objfile; gdb_assert (symfile_objfile == NULL); } @@ -1100,7 +1100,7 @@ finish_new_objfile (struct objfile *objfile, symfile_add_flags add_flags) ABFD is a BFD already open on the file, as from symfile_bfd_open. A new reference is acquired by this function. - For NAME description see allocate_objfile's definition. + For NAME description see the objfile constructor. ADD_FLAGS encodes verbosity, whether this is main symbol file or extra, such as dynamically loaded code, and what to do with breakpoins. @@ -1144,7 +1144,7 @@ symbol_file_add_with_addrs (bfd *abfd, const char *name, if (mainline) flags |= OBJF_MAINLINE; - objfile = allocate_objfile (abfd, name, flags); + objfile = new struct objfile (abfd, name, flags); if (parent) add_separate_debug_objfile (objfile, parent); @@ -1218,7 +1218,7 @@ symbol_file_add_with_addrs (bfd *abfd, const char *name, } /* Add BFD as a separate debug file for OBJFILE. For NAME description - see allocate_objfile's definition. */ + see the objfile constructor. */ void symbol_file_add_separate (bfd *bfd, const char *name, @@ -2377,7 +2377,7 @@ remove_symbol_file_command (const char *args, int from_tty) objfile_name (objf))) error (_("Not confirmed.")); - free_objfile (objf); + delete objf; clear_symtab_users (0); } |