aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-11-01 16:21:04 -0600
committerTom Tromey <tom@tromey.com>2019-12-12 15:50:52 -0700
commit268e4f09144c48e02f01d82ab3aab359457df214 (patch)
tree8685bc0ca92837f6f41a97059378b1b12d44cf96 /gdb/symfile.c
parentf65fe5704af56aca58fd5547d0841a9512e540af (diff)
downloadgdb-268e4f09144c48e02f01d82ab3aab359457df214.zip
gdb-268e4f09144c48e02f01d82ab3aab359457df214.tar.gz
gdb-268e4f09144c48e02f01d82ab3aab359457df214.tar.bz2
Make the objfile destructor private
The idea behind this is that, in the long run, some code will need to be able to hold onto an objfile after it is unlinked from the program space. In particular, this is needed for some functionality to be moved to worker threads -- otherwise the objfile can be deleted while still in use. So, this makes ~objfile private, replacing it with an "unlink" method, making it more obvious which operation is intended at the calling points. gdb/ChangeLog 2019-12-12 Tom Tromey <tom@tromey.com> * symfile.c (syms_from_objfile_1): Use objfile_up. (syms_from_objfile_1, remove_symbol_file_command): Call unlink method. (reread_symbols): Use objfile_up. * solib.c (update_solib_list, reload_shared_libraries_1): Call unlink method. * objfiles.h (struct objfile) <~objfile>: Now private. <unlink>: New method. (struct objfile_deleter): New. (objfile_up): New typedef. * objfiles.c (objfile::unlink): New method. (free_objfile_separate_debug, free_all_objfiles) (objfile_purge_solibs): Use it. * jit.c (jit_unregister_code): Remove. (jit_inferior_exit_hook, jit_event_handler): Call unlink on objfile. * compile/compile-object-run.c (do_module_cleanup): Call unlink on objfile. * compile/compile-object-load.c (compile_object_load): Use objfile_up. Change-Id: I934bee70b26b8b24e1735828fb1e60fe8a05714f
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r--gdb/symfile.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 8e3cf7f..9652371 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -940,7 +940,7 @@ syms_from_objfile_1 (struct objfile *objfile,
if an error occurs during symbol reading. */
gdb::optional<clear_symtab_users_cleanup> defer_clear_users;
- std::unique_ptr<struct objfile> objfile_holder (objfile);
+ objfile_up objfile_holder (objfile);
/* If ADDRS is NULL, put together a dummy address list.
We now establish the convention that an addr of zero means
@@ -958,7 +958,7 @@ syms_from_objfile_1 (struct objfile *objfile,
if (symfile_objfile != NULL)
{
- delete symfile_objfile;
+ symfile_objfile->unlink ();
gdb_assert (symfile_objfile == NULL);
}
@@ -2438,7 +2438,7 @@ remove_symbol_file_command (const char *args, int from_tty)
objfile_name (objf)))
error (_("Not confirmed."));
- delete objf;
+ objf->unlink ();
clear_symtab_users (0);
}
@@ -2495,7 +2495,7 @@ reread_symbols (void)
/* If we get an error, blow away this objfile (not sure if
that is the correct response for things like shared
libraries). */
- std::unique_ptr<struct objfile> objfile_holder (objfile);
+ objfile_up objfile_holder (objfile);
/* We need to do this whenever any symbols go away. */
clear_symtab_users_cleanup defer_clear_users (0);