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.
This commit is contained in:
parent
7f6743fd09
commit
ed2b3126d1
5 changed files with 19 additions and 24 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
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.
|
||||||
|
|
||||||
2017-11-04 Tom Tromey <tom@tromey.com>
|
2017-11-04 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* sparc64-tdep.c (do_examine): Use gdb::def_vector.
|
* sparc64-tdep.c (do_examine): Use gdb::def_vector.
|
||||||
|
|
|
@ -606,7 +606,7 @@ struct compile_module *
|
||||||
compile_object_load (const compile_file_names &file_names,
|
compile_object_load (const compile_file_names &file_names,
|
||||||
enum compile_i_scope_types scope, void *scope_data)
|
enum compile_i_scope_types scope, void *scope_data)
|
||||||
{
|
{
|
||||||
struct cleanup *cleanups, *cleanups_free_objfile;
|
struct cleanup *cleanups;
|
||||||
struct setup_sections_data setup_sections_data;
|
struct setup_sections_data setup_sections_data;
|
||||||
CORE_ADDR addr, regs_addr, out_value_addr = 0;
|
CORE_ADDR addr, regs_addr, out_value_addr = 0;
|
||||||
struct symbol *func_sym;
|
struct symbol *func_sym;
|
||||||
|
@ -656,9 +656,10 @@ compile_object_load (const compile_file_names &file_names,
|
||||||
|
|
||||||
/* SYMFILE_VERBOSE is not passed even if FROM_TTY, user is not interested in
|
/* SYMFILE_VERBOSE is not passed even if FROM_TTY, user is not interested in
|
||||||
"Reading symbols from ..." message for automatically generated file. */
|
"Reading symbols from ..." message for automatically generated file. */
|
||||||
objfile = symbol_file_add_from_bfd (abfd.get (), filename.get (),
|
std::unique_ptr<struct objfile> objfile_holder
|
||||||
0, NULL, 0, NULL);
|
(symbol_file_add_from_bfd (abfd.get (), filename.get (),
|
||||||
cleanups_free_objfile = make_cleanup_free_objfile (objfile);
|
0, NULL, 0, NULL));
|
||||||
|
objfile = objfile_holder.get ();
|
||||||
|
|
||||||
func_sym = lookup_global_symbol_from_objfile (objfile,
|
func_sym = lookup_global_symbol_from_objfile (objfile,
|
||||||
GCC_FE_WRAPPER_FUNCTION,
|
GCC_FE_WRAPPER_FUNCTION,
|
||||||
|
@ -812,10 +813,8 @@ compile_object_load (const compile_file_names &file_names,
|
||||||
paddress (target_gdbarch (), out_value_addr));
|
paddress (target_gdbarch (), out_value_addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
discard_cleanups (cleanups_free_objfile);
|
|
||||||
|
|
||||||
retval = XNEW (struct compile_module);
|
retval = XNEW (struct compile_module);
|
||||||
retval->objfile = objfile;
|
retval->objfile = objfile_holder.release ();
|
||||||
retval->source_file = xstrdup (file_names.source_file ());
|
retval->source_file = xstrdup (file_names.source_file ());
|
||||||
retval->func_sym = func_sym;
|
retval->func_sym = func_sym;
|
||||||
retval->regs_addr = regs_addr;
|
retval->regs_addr = regs_addr;
|
||||||
|
|
|
@ -729,18 +729,6 @@ objfile::~objfile ()
|
||||||
htab_delete (static_links);
|
htab_delete (static_links);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
do_free_objfile_cleanup (void *obj)
|
|
||||||
{
|
|
||||||
delete (struct objfile *) obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct cleanup *
|
|
||||||
make_cleanup_free_objfile (struct objfile *obj)
|
|
||||||
{
|
|
||||||
return make_cleanup (do_free_objfile_cleanup, obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free all the object files at once and clean up their users. */
|
/* Free all the object files at once and clean up their users. */
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -479,8 +479,6 @@ extern void unlink_objfile (struct objfile *);
|
||||||
|
|
||||||
extern void free_objfile_separate_debug (struct objfile *);
|
extern void free_objfile_separate_debug (struct objfile *);
|
||||||
|
|
||||||
extern struct cleanup *make_cleanup_free_objfile (struct objfile *);
|
|
||||||
|
|
||||||
extern void free_all_objfiles (void);
|
extern void free_all_objfiles (void);
|
||||||
|
|
||||||
extern void objfile_relocate (struct objfile *, const struct section_offsets *);
|
extern void objfile_relocate (struct objfile *, const struct section_offsets *);
|
||||||
|
|
|
@ -997,7 +997,8 @@ syms_from_objfile_1 (struct objfile *objfile,
|
||||||
|
|
||||||
/* Make sure that partially constructed symbol tables will be cleaned up
|
/* Make sure that partially constructed symbol tables will be cleaned up
|
||||||
if an error occurs during symbol reading. */
|
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.
|
/* If ADDRS is NULL, put together a dummy address list.
|
||||||
We now establish the convention that an addr of zero means
|
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. */
|
/* Discard cleanups as symbol reading was successful. */
|
||||||
|
|
||||||
|
objfile_holder.release ();
|
||||||
discard_cleanups (old_chain);
|
discard_cleanups (old_chain);
|
||||||
xfree (local_addr);
|
xfree (local_addr);
|
||||||
}
|
}
|
||||||
|
@ -2436,9 +2438,10 @@ reread_symbols (void)
|
||||||
/* If we get an error, blow away this objfile (not sure if
|
/* If we get an error, blow away this objfile (not sure if
|
||||||
that is the correct response for things like shared
|
that is the correct response for things like shared
|
||||||
libraries). */
|
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. */
|
/* 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
|
if (exec_bfd != NULL
|
||||||
&& filename_cmp (bfd_get_filename (objfile->obfd),
|
&& filename_cmp (bfd_get_filename (objfile->obfd),
|
||||||
|
@ -2600,6 +2603,7 @@ reread_symbols (void)
|
||||||
reinit_frame_cache ();
|
reinit_frame_cache ();
|
||||||
|
|
||||||
/* Discard cleanups as symbol reading was successful. */
|
/* Discard cleanups as symbol reading was successful. */
|
||||||
|
objfile_holder.release ();
|
||||||
discard_cleanups (old_cleanups);
|
discard_cleanups (old_cleanups);
|
||||||
|
|
||||||
/* If the mtime has changed between the time we set new_modtime
|
/* If the mtime has changed between the time we set new_modtime
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue