aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib.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/solib.c
parent487ad57ccfe1434e21774117d20dfd9e23f12afa (diff)
downloadfsf-binutils-gdb-63644780babdca3f40e1978a236b6cd78473c91b.zip
fsf-binutils-gdb-63644780babdca3f40e1978a236b6cd78473c91b.tar.gz
fsf-binutils-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/solib.c')
-rw-r--r--gdb/solib.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gdb/solib.c b/gdb/solib.c
index 8ed492a..06e0b16 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1496,6 +1496,23 @@ gdb_bfd_lookup_symbol (bfd *abfd,
return symaddr;
}
+/* SO_LIST_HEAD may contain user-loaded object files that can be removed
+ out-of-band by the user. So upon notification of free_objfile remove
+ all references to any user-loaded file that is about to be freed. */
+
+static void
+remove_user_added_objfile (struct objfile *objfile)
+{
+ struct so_list *so;
+
+ if (objfile != 0 && objfile->flags & OBJF_USERLOADED)
+ {
+ for (so = so_list_head; so != NULL; so = so->next)
+ if (so->objfile == objfile)
+ so->objfile = NULL;
+ }
+}
+
extern initialize_file_ftype _initialize_solib; /* -Wmissing-prototypes */
void
@@ -1503,6 +1520,8 @@ _initialize_solib (void)
{
solib_data = gdbarch_data_register_pre_init (solib_init);
+ observer_attach_free_objfile (remove_user_added_objfile);
+
add_com ("sharedlibrary", class_files, sharedlibrary_command,
_("Load shared object library symbols for files matching REGEXP."));
add_info ("sharedlibrary", info_sharedlibrary_command,