From 63644780babdca3f40e1978a236b6cd78473c91b Mon Sep 17 00:00:00 2001 From: Nicolas Blanc Date: Tue, 12 Mar 2013 11:10:18 +0100 Subject: New remove-symbol-file command. New command for removing symbol files added via the add-symbol-file command. 2013-10-29 Nicolas Blanc * 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 --- gdb/objfiles.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'gdb/objfiles.c') 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, -- cgit v1.1