aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.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/breakpoint.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/breakpoint.c')
-rw-r--r--gdb/breakpoint.c67
1 files changed, 64 insertions, 3 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index e172be1..608463d 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -7475,9 +7475,9 @@ disable_breakpoints_in_shlibs (void)
}
}
-/* Disable any breakpoints and tracepoints that are in an unloaded shared
- library. Only apply to enabled breakpoints, disabled ones can just stay
- disabled. */
+/* Disable any breakpoints and tracepoints that are in SOLIB upon
+ notification of unloaded_shlib. Only apply to enabled breakpoints,
+ disabled ones can just stay disabled. */
static void
disable_breakpoints_in_unloaded_shlib (struct so_list *solib)
@@ -7529,6 +7529,66 @@ disable_breakpoints_in_unloaded_shlib (struct so_list *solib)
}
}
+/* Disable any breakpoints and tracepoints in OBJFILE upon
+ notification of free_objfile. Only apply to enabled breakpoints,
+ disabled ones can just stay disabled. */
+
+static void
+disable_breakpoints_in_freed_objfile (struct objfile *objfile)
+{
+ struct breakpoint *b;
+
+ if (objfile == NULL)
+ return;
+
+ /* If the file is a shared library not loaded by the user then
+ solib_unloaded was notified and disable_breakpoints_in_unloaded_shlib
+ was called. In that case there is no need to take action again. */
+ if ((objfile->flags & OBJF_SHARED) && !(objfile->flags & OBJF_USERLOADED))
+ return;
+
+ ALL_BREAKPOINTS (b)
+ {
+ struct bp_location *loc;
+ int bp_modified = 0;
+
+ if (!is_breakpoint (b) && !is_tracepoint (b))
+ continue;
+
+ for (loc = b->loc; loc != NULL; loc = loc->next)
+ {
+ CORE_ADDR loc_addr = loc->address;
+
+ if (loc->loc_type != bp_loc_hardware_breakpoint
+ && loc->loc_type != bp_loc_software_breakpoint)
+ continue;
+
+ if (loc->shlib_disabled != 0)
+ continue;
+
+ if (objfile->pspace != loc->pspace)
+ continue;
+
+ if (loc->loc_type != bp_loc_hardware_breakpoint
+ && loc->loc_type != bp_loc_software_breakpoint)
+ continue;
+
+ if (is_addr_in_objfile (loc_addr, objfile))
+ {
+ loc->shlib_disabled = 1;
+ loc->inserted = 0;
+
+ mark_breakpoint_location_modified (loc);
+
+ bp_modified = 1;
+ }
+ }
+
+ if (bp_modified)
+ observer_notify_breakpoint_modified (b);
+ }
+}
+
/* FORK & VFORK catchpoints. */
/* An instance of this type is used to represent a fork or vfork
@@ -16007,6 +16067,7 @@ _initialize_breakpoint (void)
initialize_breakpoint_ops ();
observer_attach_solib_unloaded (disable_breakpoints_in_unloaded_shlib);
+ observer_attach_free_objfile (disable_breakpoints_in_freed_objfile);
observer_attach_inferior_exit (clear_syscall_counts);
observer_attach_memory_changed (invalidate_bp_value_on_memory_change);