Blame SOURCES/gdb-dlopen-stap-probe-2of9.patch

861f93
http://sourceware.org/ml/gdb-cvs/2013-06/msg00013.html
861f93
861f93
### src/gdb/ChangeLog	2013/06/04 12:50:20	1.15681
861f93
### src/gdb/ChangeLog	2013/06/04 12:53:33	1.15682
861f93
## -1,5 +1,24 @@
861f93
 2013-06-04  Gary Benson  <gbenson@redhat.com>
861f93
 
861f93
+	* objfiles.h (inhibit_section_map_updates): New function
861f93
+	declaration.
861f93
+	(resume_section_map_updates): Likewise.
861f93
+	(resume_section_map_updates_cleanup): Likewise.
861f93
+	* objfiles.c (objfile_pspace_info): Removed field
861f93
+	"objfiles_changed_p".  New fields "new_objfiles_available",
861f93
+	"section_map_dirty" and "inhibit_updates".
861f93
+	(allocate_objfile): Set new_objfiles_available.
861f93
+	(free_objfile): Set section_map_dirty.
861f93
+	(objfile_relocate1): Likewise.
861f93
+	(in_plt_section): Likewise.
861f93
+	(find_pc_section): Update the conditions under which the
861f93
+	section map will be updated.
861f93
+	(inhibit_section_map_updates): New function.
861f93
+	(resume_section_map_updates): Likewise.
861f93
+	(resume_section_map_updates_cleanup): Likewise.
861f93
+
861f93
+2013-06-04  Gary Benson  <gbenson@redhat.com>
861f93
+
861f93
 	* probe.h (get_probe_argument_count): New declaration.
861f93
 	(evaluate_probe_argument): Likewise.
861f93
 	* probe.c (get_probe_argument_count): New function.
861f93
--- src/gdb/objfiles.c	2013/05/06 19:15:17	1.160
861f93
+++ src/gdb/objfiles.c	2013/06/04 12:53:34	1.161
861f93
@@ -67,9 +67,18 @@
861f93
 
861f93
 struct objfile_pspace_info
861f93
 {
861f93
-  int objfiles_changed_p;
861f93
   struct obj_section **sections;
861f93
   int num_sections;
861f93
+
861f93
+  /* Nonzero if object files have been added since the section map
861f93
+     was last updated.  */
861f93
+  int new_objfiles_available;
861f93
+
861f93
+  /* Nonzero if the section map MUST be updated before use.  */
861f93
+  int section_map_dirty;
861f93
+
861f93
+  /* Nonzero if section map updates should be inhibited if possible.  */
861f93
+  int inhibit_updates;
861f93
 };
861f93
 
861f93
 /* Per-program-space data key.  */
861f93
@@ -317,7 +326,7 @@
861f93
   objfile->flags |= flags;
861f93
 
861f93
   /* Rebuild section map next time we need it.  */
861f93
-  get_objfile_pspace_data (objfile->pspace)->objfiles_changed_p = 1;
861f93
+  get_objfile_pspace_data (objfile->pspace)->new_objfiles_available = 1;
861f93
 
861f93
   return objfile;
861f93
 }
861f93
@@ -646,7 +655,7 @@
861f93
   obstack_free (&objfile->objfile_obstack, 0);
861f93
 
861f93
   /* Rebuild section map next time we need it.  */
861f93
-  get_objfile_pspace_data (objfile->pspace)->objfiles_changed_p = 1;
861f93
+  get_objfile_pspace_data (objfile->pspace)->section_map_dirty = 1;
861f93
 
861f93
   xfree (objfile);
861f93
 }
861f93
@@ -826,7 +835,7 @@
861f93
   }
861f93
 
861f93
   /* Rebuild section map next time we need it.  */
861f93
-  get_objfile_pspace_data (objfile->pspace)->objfiles_changed_p = 1;
861f93
+  get_objfile_pspace_data (objfile->pspace)->section_map_dirty = 1;
861f93
 
861f93
   /* Update the table in exec_ops, used to read memory.  */
861f93
   ALL_OBJFILE_OSECTIONS (objfile, s)
861f93
@@ -1291,11 +1300,14 @@
861f93
 update_section_map (struct program_space *pspace,
861f93
 		    struct obj_section ***pmap, int *pmap_size)
861f93
 {
861f93
+  struct objfile_pspace_info *pspace_info;
861f93
   int alloc_size, map_size, i;
861f93
   struct obj_section *s, **map;
861f93
   struct objfile *objfile;
861f93
 
861f93
-  gdb_assert (get_objfile_pspace_data (pspace)->objfiles_changed_p != 0);
861f93
+  pspace_info = get_objfile_pspace_data (pspace);
861f93
+  gdb_assert (pspace_info->section_map_dirty != 0
861f93
+	      || pspace_info->new_objfiles_available != 0);
861f93
 
861f93
   map = *pmap;
861f93
   xfree (map);
861f93
@@ -1365,7 +1377,9 @@
861f93
     return s;
861f93
 
861f93
   pspace_info = get_objfile_pspace_data (current_program_space);
861f93
-  if (pspace_info->objfiles_changed_p != 0)
861f93
+  if (pspace_info->section_map_dirty
861f93
+      || (pspace_info->new_objfiles_available
861f93
+	  && !pspace_info->inhibit_updates))
861f93
     {
861f93
       update_section_map (current_program_space,
861f93
 			  &pspace_info->sections,
861f93
@@ -1373,7 +1387,8 @@
861f93
 
861f93
       /* Don't need updates to section map until objfiles are added,
861f93
          removed or relocated.  */
861f93
-      pspace_info->objfiles_changed_p = 0;
861f93
+      pspace_info->new_objfiles_available = 0;
861f93
+      pspace_info->section_map_dirty = 0;
861f93
     }
861f93
 
861f93
   /* The C standard (ISO/IEC 9899:TC2) requires the BASE argument to
861f93
@@ -1414,14 +1429,38 @@
861f93
 }
861f93
 
861f93
 
861f93
-/* Set objfiles_changed_p so section map will be rebuilt next time it
861f93
+/* Set section_map_dirty so section map will be rebuilt next time it
861f93
    is used.  Called by reread_symbols.  */
861f93
 
861f93
 void
861f93
 objfiles_changed (void)
861f93
 {
861f93
   /* Rebuild section map next time we need it.  */
861f93
-  get_objfile_pspace_data (current_program_space)->objfiles_changed_p = 1;
861f93
+  get_objfile_pspace_data (current_program_space)->section_map_dirty = 1;
861f93
+}
861f93
+
861f93
+/* See comments in objfiles.h.  */
861f93
+
861f93
+void
861f93
+inhibit_section_map_updates (struct program_space *pspace)
861f93
+{
861f93
+  get_objfile_pspace_data (pspace)->inhibit_updates = 1;
861f93
+}
861f93
+
861f93
+/* See comments in objfiles.h.  */
861f93
+
861f93
+void
861f93
+resume_section_map_updates (struct program_space *pspace)
861f93
+{
861f93
+  get_objfile_pspace_data (pspace)->inhibit_updates = 0;
861f93
+}
861f93
+
861f93
+/* See comments in objfiles.h.  */
861f93
+
861f93
+void
861f93
+resume_section_map_updates_cleanup (void *arg)
861f93
+{
861f93
+  resume_section_map_updates (arg);
861f93
 }
861f93
 
861f93
 /* The default implementation for the "iterate_over_objfiles_in_search_order"
861f93
--- src/gdb/objfiles.h	2013/05/06 19:15:17	1.106
861f93
+++ src/gdb/objfiles.h	2013/06/04 12:53:34	1.107
861f93
@@ -501,6 +501,22 @@
861f93
    modules.  */
861f93
 DECLARE_REGISTRY(objfile);
861f93
 
861f93
+/* In normal use, the section map will be rebuilt by find_pc_section
861f93
+   if objfiles have been added, removed or relocated since it was last
861f93
+   called.  Calling inhibit_section_map_updates will inhibit this
861f93
+   behavior until resume_section_map_updates is called.  If you call
861f93
+   inhibit_section_map_updates you must ensure that every call to
861f93
+   find_pc_section in the inhibited region relates to a section that
861f93
+   is already in the section map and has not since been removed or
861f93
+   relocated.  */
861f93
+extern void inhibit_section_map_updates (struct program_space *pspace);
861f93
+
861f93
+/* Resume automatically rebuilding the section map as required.  */
861f93
+extern void resume_section_map_updates (struct program_space *pspace);
861f93
+
861f93
+/* Version of the above suitable for use as a cleanup.  */
861f93
+extern void resume_section_map_updates_cleanup (void *arg);
861f93
+
861f93
 extern void default_iterate_over_objfiles_in_search_order
861f93
   (struct gdbarch *gdbarch,
861f93
    iterate_over_objfiles_in_search_order_cb_ftype *cb,