* solist.h (struct target_so_ops): New member clear_so.
authorDoug Evans <dje@google.com>
Mon, 6 May 2013 22:18:39 +0000 (22:18 +0000)
committerDoug Evans <dje@google.com>
Mon, 6 May 2013 22:18:39 +0000 (22:18 +0000)
* solib-svr4.c (svr4_clear_so): New function.
(_initialize_svr4_solib): Set svr4_so_ops.clear_so.
* solib.c (clear_so): Renamed from free_so_symbols.
All callers updated.  Call target clear_so if it exists.

gdb/ChangeLog
gdb/solib-svr4.c
gdb/solib.c
gdb/solist.h

index e520f9662652f68fa50a3ce5cdba7a84b66363b9..04457826e9da58495f06e984a747567e523e39b4 100644 (file)
@@ -1,3 +1,11 @@
+2013-05-06  Doug Evans  <dje@google.com>
+
+       * solist.h (struct target_so_ops): New member clear_so.
+       * solib-svr4.c (svr4_clear_so): New function.
+       (_initialize_svr4_solib): Set svr4_so_ops.clear_so.
+       * solib.c (clear_so): Renamed from free_so_symbols.
+       All callers updated.  Call target clear_so if it exists.
+
 2013-05-06  Tom Tromey  <tromey@redhat.com>
 
        * ada-lang.c (ada_value_primitive_packed_val): Don't
index f3bff6e297e51fff90e82cfb002ef603aafc3c10..4e094728e89ec6f0a82f6418f0c003d88ba5ec89 100644 (file)
@@ -966,6 +966,14 @@ svr4_free_so (struct so_list *so)
   xfree (so->lm_info);
 }
 
+/* Implement target_so_ops.clear_so.  */
+
+static void
+svr4_clear_so (struct so_list *so)
+{
+  so->lm_info->l_addr_p = 0;
+}
+
 /* Free so_list built so far (called via cleanup).  */
 
 static void
@@ -2448,6 +2456,7 @@ _initialize_svr4_solib (void)
 
   svr4_so_ops.relocate_section_addresses = svr4_relocate_section_addresses;
   svr4_so_ops.free_so = svr4_free_so;
+  svr4_so_ops.clear_so = svr4_clear_so;
   svr4_so_ops.clear_solib = svr4_clear_solib;
   svr4_so_ops.solib_create_inferior_hook = svr4_solib_create_inferior_hook;
   svr4_so_ops.special_symbol_handling = svr4_special_symbol_handling;
index af48388812a2cea5e9b6d8a21c0d3709c1b10949..72db375b0d8fdf88c9dd61a77c55443462e7b175 100644 (file)
@@ -499,17 +499,20 @@ solib_map_sections (struct so_list *so)
   return 1;
 }
 
-/* Free symbol-file related contents of SO.  If we have opened a BFD
-   for SO, close it.  If we have placed SO's sections in some target's
-   section table, the caller is responsible for removing them.
+/* Free symbol-file related contents of SO and reset for possible reloading
+   of SO.  If we have opened a BFD for SO, close it.  If we have placed SO's
+   sections in some target's section table, the caller is responsible for
+   removing them.
 
    This function doesn't mess with objfiles at all.  If there is an
    objfile associated with SO that needs to be removed, the caller is
    responsible for taking care of that.  */
 
 static void
-free_so_symbols (struct so_list *so)
+clear_so (struct so_list *so)
 {
+  struct target_so_ops *ops = solib_ops (target_gdbarch ());
+
   if (so->sections)
     {
       xfree (so->sections);
@@ -528,6 +531,10 @@ free_so_symbols (struct so_list *so)
   /* Restore the target-supplied file name.  SO_NAME may be the path
      of the symbol file.  */
   strcpy (so->so_name, so->so_original_name);
+
+  /* Do the same for target-specific data.  */
+  if (ops->clear_so != NULL)
+    ops->clear_so (so);
 }
 
 /* Free the storage associated with the `struct so_list' object SO.
@@ -546,7 +553,7 @@ free_so (struct so_list *so)
 {
   struct target_so_ops *ops = solib_ops (target_gdbarch ());
 
-  free_so_symbols (so);
+  clear_so (so);
   ops->free_so (so);
 
   xfree (so);
@@ -1238,7 +1245,7 @@ reload_shared_libraries_1 (int from_tty)
              && !solib_used (so))
            free_objfile (so->objfile);
          remove_target_sections (so, so->abfd);
-         free_so_symbols (so);
+         clear_so (so);
        }
 
       /* If this shared library is now associated with a new symbol
index f784fc349ed592479f9e31d1e8d0d9ac6643b728..049547417f85a3ec248a62e5ac295e04a8259c8d 100644 (file)
@@ -88,6 +88,11 @@ struct target_so_ops
        associated with a so_list entry.  */
     void (*free_so) (struct so_list *so);
 
+    /* Reset private data structures associated with SO.
+       This is called when SO is about to be reloaded.
+       It is also called before free_so when SO is about to be freed.  */
+    void (*clear_so) (struct so_list *so);
+
     /* Reset or free private data structures not associated with
        so_list entries.  */
     void (*clear_solib) (void);
This page took 0.031868 seconds and 4 git commands to generate.