aboutsummaryrefslogtreecommitdiff
path: root/gdb/objfiles.c
diff options
context:
space:
mode:
authorNicolas Blanc <nicolas.blanc@intel.com>2013-03-12 11:10:18 +0100
committerNicolas Blanc <nicolas.blanc@intel.com>2013-10-29 10:56:07 +0100
commit63644780babdca3f40e1978a236b6cd78473c91b (patch)
tree03ed0d042a594a71df9c9921b1c8f9c1018675f0 /gdb/objfiles.c
parent487ad57ccfe1434e21774117d20dfd9e23f12afa (diff)
downloadgdb-63644780babdca3f40e1978a236b6cd78473c91b.zip
gdb-63644780babdca3f40e1978a236b6cd78473c91b.tar.gz
gdb-63644780babdca3f40e1978a236b6cd78473c91b.tar.bz2
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>
Diffstat (limited to 'gdb/objfiles.c')
-rw-r--r--gdb/objfiles.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 7029196..70a927a 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -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,