New remove-symbol-file command.

New command for removing symbol files added via
the add-symbol-file command.

2013-10-29  Nicolas Blanc  <nicolas.blanc@intel.com>

	* breakpoint.c (disable_breakpoints_in_freed_objfile): New function.
	* objfiles.c (free_objfile): Notify free_objfile.
	(is_addr_in_objfile): New function.
	* objfiles.h (is_addr_in_objfile): New declaration.
	* printcmd.c (clear_dangling_display_expressions): Act upon free_objfile
	events instead of solib_unloaded events.
	(_initialize_printcmd): Register observer for free_objfile instead
	of solib_unloaded notifications.
	* solib.c (remove_user_added_objfile): New function.
	* symfile.c (remove_symbol_file_command): New command.
	(_initialize_symfile): Add remove-symbol-file.
gdb/doc
	* observer.texi: New free_objfile event.

Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
This commit is contained in:
Nicolas Blanc
2013-03-12 11:10:18 +01:00
parent 487ad57ccf
commit 63644780ba
7 changed files with 209 additions and 9 deletions

View File

@@ -548,6 +548,9 @@ free_objfile_separate_debug (struct objfile *objfile)
void
free_objfile (struct objfile *objfile)
{
/* First notify observers that this objfile is about to be freed. */
observer_notify_free_objfile (objfile);
/* Free all separate debug objfiles. */
free_objfile_separate_debug (objfile);
@@ -1464,6 +1467,29 @@ resume_section_map_updates_cleanup (void *arg)
resume_section_map_updates (arg);
}
/* Return 1 if ADDR maps into one of the sections of OBJFILE and 0
otherwise. */
int
is_addr_in_objfile (CORE_ADDR addr, const struct objfile *objfile)
{
struct obj_section *osect;
if (objfile == NULL)
return 0;
ALL_OBJFILE_OSECTIONS (objfile, osect)
{
if (section_is_overlay (osect) && !section_is_mapped (osect))
continue;
if (obj_section_addr (osect) <= addr
&& addr < obj_section_endaddr (osect))
return 1;
}
return 0;
}
/* The default implementation for the "iterate_over_objfiles_in_search_order"
gdbarch method. It is equivalent to use the ALL_OBJFILES macro,
searching the objfiles in the order they are stored internally,