This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
segv in `info target': stale ptrs
- To: gdb-patches at sources dot redhat dot com
- Subject: segv in `info target': stale ptrs
- From: "Golubev I. N." <gin at mo dot msk dot ru>
- Date: Sun, 26 Aug 2001 15:40:26 (GMT)
Details of the bug are in
<02523b862c7b79-gin@mo.msk.ru> posted to <bug-gdb@gnu.org> on Fri, 24
Aug 2001 10:29:16 (GMT);
<02363965d1ec40-gin@mo.msk.ru> posted to <bug-gdb@gnu.org> on Fri, 07
Jul 2000 12:49:48 (GMT).
* solib.c (clear_solib): Call `remove_target_sections' to fix
stale pointers in `struct target_ops'.
* irix5-nat.c (clear_solib): Ditto.
* osfsolib.c (clear_solib): Ditto.
--- solib.c 2001/08/24 07:57:42 1.1
+++ solib.c 2001/08/24 09:27:05
@@ -1591,7 +1591,11 @@
while (so_list_head)
{
struct so_list *so = so_list_head;
+ bfd *abfd = so->abfd;
+
so_list_head = so->next;
+ if (abfd)
+ remove_target_sections (abfd);
free_so (so);
}
--- irix5-nat.c 2001/08/24 08:44:43 1.1
+++ irix5-nat.c 2001/08/24 09:31:23
@@ -1066,14 +1066,17 @@
while (so_list_head)
{
+ bfd *abfd = so_list_head->abfd;
+
if (so_list_head->sections)
{
free ((PTR) so_list_head->sections);
}
- if (so_list_head->abfd)
+ if (abfd)
{
- bfd_filename = bfd_get_filename (so_list_head->abfd);
- if (!bfd_close (so_list_head->abfd))
+ remove_target_sections (abfd);
+ bfd_filename = bfd_get_filename (abfd);
+ if (!bfd_close (abfd))
warning ("cannot close \"%s\": %s",
bfd_filename, bfd_errmsg (bfd_get_error ()));
}
--- osfsolib.c 2001/08/24 08:53:15 1.1
+++ osfsolib.c 2001/08/24 09:32:58
@@ -819,14 +819,17 @@
while (so_list_head)
{
+ bfd *abfd = so_list_head->abfd;
+
if (so_list_head->sections)
{
free ((PTR) so_list_head->sections);
}
- if (so_list_head->abfd)
+ if (abfd)
{
- bfd_filename = bfd_get_filename (so_list_head->abfd);
- if (!bfd_close (so_list_head->abfd))
+ remove_target_sections (abfd);
+ bfd_filename = bfd_get_filename (abfd);
+ if (!bfd_close (abfd))
warning ("cannot close \"%s\": %s",
bfd_filename, bfd_errmsg (bfd_get_error ()));
}