aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-11-01 18:51:15 -0600
committerTom Tromey <tom@tromey.com>2017-11-04 10:27:18 -0600
commited2b3126d1828d55d57880c6b6045a4e58c05cde (patch)
tree20e7536b313e0fd676548fea0e253c2290988608 /gdb/symfile.c
parent7f6743fd09d0f3188dd9dcdf31acf81131f9bf1f (diff)
downloadgdb-ed2b3126d1828d55d57880c6b6045a4e58c05cde.zip
gdb-ed2b3126d1828d55d57880c6b6045a4e58c05cde.tar.gz
gdb-ed2b3126d1828d55d57880c6b6045a4e58c05cde.tar.bz2
Remove make_cleanup_free_objfile
This replaces make_cleanup_free_objfile with std::unique_ptr. gdb/ChangeLog 2017-11-04 Tom Tromey <tom@tromey.com> * objfiles.c (do_free_objfile_cleanup): Remove. * compile/compile-object-load.c (compile_object_load): Update. * objfiles.h (make_cleanup_free_objfile): Remove.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r--gdb/symfile.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c
index dae750e..9afd994 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -997,7 +997,8 @@ syms_from_objfile_1 (struct objfile *objfile,
/* Make sure that partially constructed symbol tables will be cleaned up
if an error occurs during symbol reading. */
- old_chain = make_cleanup_free_objfile (objfile);
+ old_chain = make_cleanup (null_cleanup, NULL);
+ std::unique_ptr<struct objfile> objfile_holder (objfile);
/* If ADDRS is NULL, put together a dummy address list.
We now establish the convention that an addr of zero means
@@ -1053,6 +1054,7 @@ syms_from_objfile_1 (struct objfile *objfile,
/* Discard cleanups as symbol reading was successful. */
+ objfile_holder.release ();
discard_cleanups (old_chain);
xfree (local_addr);
}
@@ -2436,9 +2438,10 @@ 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). */
- old_cleanups = make_cleanup_free_objfile (objfile);
+ std::unique_ptr<struct objfile> objfile_holder (objfile);
+
/* We need to do this whenever any symbols go away. */
- make_cleanup (clear_symtab_users_cleanup, 0 /*ignore*/);
+ old_cleanups = make_cleanup (clear_symtab_users_cleanup, 0 /*ignore*/);
if (exec_bfd != NULL
&& filename_cmp (bfd_get_filename (objfile->obfd),
@@ -2600,6 +2603,7 @@ reread_symbols (void)
reinit_frame_cache ();
/* Discard cleanups as symbol reading was successful. */
+ objfile_holder.release ();
discard_cleanups (old_cleanups);
/* If the mtime has changed between the time we set new_modtime