2009-07-22 Paul Pluzhnikov <ppluzhnikov@google.com>
authorPaul Pluzhnikov <ppluzhnikov@google.com>
Wed, 22 Jul 2009 19:21:31 +0000 (19:21 +0000)
committerPaul Pluzhnikov <ppluzhnikov@google.com>
Wed, 22 Jul 2009 19:21:31 +0000 (19:21 +0000)
* objfiles.h (objfiles_changed): New prototype.
* objfiles.c (objfiles_updated_p): Rename to objfiles_changed_p.
(allocate_objfile, free_objfile): Must rebuild section map.
(objfile_relocate): Likewise.
(update_section_map, find_pc_section): Adjust.
(set_objfiles_updated_on_exe_change): Remove.
(set_objfiles_updated_on_solib_activity): Remove.
(_initialize_objfiles): Remove.
(objfiles_changed): New function.
* symfile.c (reread_symbols): Call objfiles_changed.

gdb/ChangeLog
gdb/objfiles.c
gdb/objfiles.h
gdb/symfile.c

index f63fab7bb176c5ad3a6ead93bb6261ace3e6afbb..a741045cdc2d2ce53b5cb8cf12bb18d1fc4a1f58 100644 (file)
@@ -1,3 +1,16 @@
+2009-07-22  Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+       * objfiles.h (objfiles_changed): New prototype.
+       * objfiles.c (objfiles_updated_p): Rename to objfiles_changed_p.
+       (allocate_objfile, free_objfile): Must rebuild section map.
+       (objfile_relocate): Likewise.
+       (update_section_map, find_pc_section): Adjust.
+       (set_objfiles_updated_on_exe_change): Remove.
+       (set_objfiles_updated_on_solib_activity): Remove.
+       (_initialize_objfiles): Remove.
+       (objfiles_changed): New function.
+       * symfile.c (reread_symbols): Call objfiles_changed.    
+       
 2009-07-22  Hui Zhu  <teawater@gmail.com>
 
        * record.c (record_xfer_partial): Call error When nquery
index ab5f0ea381bd15abeb694d8bd93fd4a4b9e6aebf..4662e1b12121788cfc90daf050a3761cb9d182e8 100644 (file)
@@ -68,7 +68,7 @@ struct objfile *rt_common_objfile;    /* For runtime common symbols */
 /* Records whether any objfiles appeared or disappeared since we last updated
    address to obj section map.  */
 
-static int objfiles_updated_p;
+static int objfiles_changed_p;
 
 /* Locate all mappable sections of a BFD file. 
    objfile_p_char is a char * to get it through
@@ -235,6 +235,8 @@ allocate_objfile (bfd *abfd, int flags)
   /* Save passed in flag bits. */
   objfile->flags |= flags;
 
+  objfiles_changed_p = 1;  /* Rebuild section map next time we need it.  */
+
   return (objfile);
 }
 
@@ -501,6 +503,7 @@ free_objfile (struct objfile *objfile)
   obstack_free (&objfile->objfile_obstack, 0);
   xfree (objfile);
   objfile = NULL;
+  objfiles_changed_p = 1;  /* Rebuild section map next time we need it.  */
 }
 
 static void
@@ -682,6 +685,7 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
 
   /* Relocate breakpoints as necessary, after things are relocated. */
   breakpoint_re_set ();
+  objfiles_changed_p = 1;  /* Rebuild section map next time we need it.  */
 }
 \f
 /* Many places in gdb want to test just to see if we have any partial
@@ -798,7 +802,7 @@ update_section_map (struct obj_section ***pmap, int *pmap_size)
   struct obj_section *s, **map;
   struct objfile *objfile;
 
-  gdb_assert (objfiles_updated_p != 0);
+  gdb_assert (objfiles_changed_p != 0);
 
   map = *pmap;
   xfree (map);
@@ -857,13 +861,13 @@ find_pc_section (CORE_ADDR pc)
   if (s)
     return s;
 
-  if (objfiles_updated_p != 0)
+  if (objfiles_changed_p != 0)
     {
       update_section_map (&sections, &num_sections);
 
       /* Don't need updates to section map until objfiles are added
          or removed.  */
-      objfiles_updated_p = 0;
+      objfiles_changed_p = 0;
     }
 
   sp = (struct obj_section **) bsearch (&pc, sections, num_sections,
@@ -989,28 +993,11 @@ objfile_data (struct objfile *objfile, const struct objfile_data *data)
   return objfile->data[data->index];
 }
 
-/* Set objfiles_updated_p so section map will be rebuilt next time it
-   is used.  Called by executable_changed observer.  */
-
-static void
-set_objfiles_updated_on_exe_change (void)
-{
-  objfiles_updated_p = 1;  /* Rebuild section map next time we need it.  */
-}
-
-/* Set objfiles_updated_p so section map will be rebuilt next time it
-   is used.  Called by solib_loaded/unloaded observer.  */
-
-static void
-set_objfiles_updated_on_solib_activity (struct so_list *so_list)
-{
-  objfiles_updated_p = 1;  /* Rebuild section map next time we need it.  */
-}
+/* Set objfiles_changed_p so section map will be rebuilt next time it
+   is used.  Called by reread_symbols.  */
 
 void
-_initialize_objfiles (void)
+objfiles_changed (void)
 {
-  observer_attach_executable_changed (set_objfiles_updated_on_exe_change);
-  observer_attach_solib_loaded (set_objfiles_updated_on_solib_activity);
-  observer_attach_solib_unloaded (set_objfiles_updated_on_solib_activity);
+  objfiles_changed_p = 1;  /* Rebuild section map next time we need it.  */
 }
index 60d3143eb978a670997079d8f7e984fbcdeda46c..18572608c527d81f88a299aa187d50e3911ead60 100644 (file)
@@ -482,6 +482,8 @@ extern int have_partial_symbols (void);
 
 extern int have_full_symbols (void);
 
+extern void objfiles_changed (void);
+
 /* This operation deletes all objfile entries that represent solibs that
    weren't explicitly loaded by the user, via e.g., the add-symbol-file
    command.
index 4dd9c1ce4e4fb3a5fd51f99d272bd3d900f25ed1..bbdb3ca069d44849d667f560f2aae6d7225299d4 100644 (file)
@@ -2457,8 +2457,10 @@ reread_symbols (void)
       /* At least one objfile has changed, so we can consider that
          the executable we're debugging has changed too.  */
       observer_notify_executable_changed ();
+
+      /* Notify objfiles that we've modified objfile sections.  */
+      objfiles_changed ();
     }
-      
 }