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

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