+2018-06-28 Tom Tromey <tom@tromey.com>
+
+ * coffread.c (coff_symfile_finish): Update.
+ * xcoffread.c (xcoff_symfile_finish): Update.
+ * elfread.c (elf_symfile_finish): Update.
+ * symfile.h (dwarf2_free_objfile): Don't declare.
+ * dwarf2read.c (_initialize_dwarf2_read): Use
+ register_objfile_data_with_cleanup.
+ (dwarf2_free_objfile): Now static. Change signature.
+
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* symfile.c (add_symbol_file_command, _initialize_symfile): Add
{
/* Let stabs reader clean up. */
stabsread_clear_cache ();
-
- dwarf2_free_objfile (objfile);
}
\f
}
}
-/* Release all extra memory associated with OBJFILE. */
+/* Cleanup function for the dwarf2_per_objfile data. */
-void
-dwarf2_free_objfile (struct objfile *objfile)
+static void
+dwarf2_free_objfile (struct objfile *objfile, void *datum)
{
struct dwarf2_per_objfile *dwarf2_per_objfile
- = get_dwarf2_per_objfile (objfile);
+ = static_cast<struct dwarf2_per_objfile *> (datum);
delete dwarf2_per_objfile;
}
void
_initialize_dwarf2_read (void)
{
-
- dwarf2_objfile_data_key = register_objfile_data ();
+ dwarf2_objfile_data_key
+ = register_objfile_data_with_cleanup (nullptr, dwarf2_free_objfile);
add_prefix_cmd ("dwarf", class_maintenance, set_dwarf_cmd, _("\
Set DWARF specific variables.\n\
static void
elf_symfile_finish (struct objfile *objfile)
{
- dwarf2_free_objfile (objfile);
}
/* ELF specific initialization routine for reading symbols. */
extern void dwarf2_build_psymtabs (struct objfile *);
extern void dwarf2_build_frame_info (struct objfile *);
-void dwarf2_free_objfile (struct objfile *);
-
/* From mdebugread.c */
extern void mdebug_build_psymtabs (minimal_symbol_reader &,
inclTable = NULL;
}
inclIndx = inclLength = inclDepth = 0;
-
- dwarf2_free_objfile (objfile);
}