aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2013-05-06 22:18:39 +0000
committerDoug Evans <dje@google.com>2013-05-06 22:18:39 +0000
commit0892cb63bda9ac0bb2dea19d04ea35b2b54429d6 (patch)
tree27fcdc4f9831db80064df749957797af8555b6fc /gdb/solib.c
parentfac51dd9e59b66e8427ed00c417cb1bf5b0679ac (diff)
downloadgdb-0892cb63bda9ac0bb2dea19d04ea35b2b54429d6.zip
gdb-0892cb63bda9ac0bb2dea19d04ea35b2b54429d6.tar.gz
gdb-0892cb63bda9ac0bb2dea19d04ea35b2b54429d6.tar.bz2
* 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.
Diffstat (limited to 'gdb/solib.c')
-rw-r--r--gdb/solib.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/gdb/solib.c b/gdb/solib.c
index af48388..72db375 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -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