This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC/RFA] dangling bfd pointer in archive cache...
> No, we should already be calling _bfd_archive_close_and_cleanup via
>
> > --- a/bfd/opncls.c
> > +++ b/bfd/opncls.c
> > @@ -719,6 +719,17 @@ bfd_close (bfd *abfd)
> > if (! BFD_SEND (abfd, _close_and_cleanup, (abfd)))
>
> this call. The problem is in coff-rs6000.c (and coff64-rs6000.c)
> where the bfd_target vector just uses bfd_true for close_and_cleanup.
Attached is a patch that implements your suggestion. Tested on ppc-aix
using AdaCore's GDB testsuite.
While at it, the powermac XCOFF backend also seemed to be using
the same code that eventually leads to the dangling pointer, and so
I fixed it as well. It's untested, but seems straightforward enough.
OK to commit?
Thanks,
--
Joel
>From 63169be6cc57b68280afa74944abbfc285e9b0ae Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Mon, 15 Oct 2012 19:29:45 +0200
Subject: [PATCH] Dangling bfd pointer in archive cache.
This dandling pointer eventually leads to a crash when trying to run
on ppc-aix a program using threading...
bfd/ChangeLog:
* coff-rs6000.c (rs6000coff_vec): Set _close_and_cleanup
field to _bfd_archive_close_and_cleanup.
(pmac_xcoff_vec): Likewise.
---
bfd/coff-rs6000.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index edbef95..0945aca 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -4076,7 +4076,7 @@ const bfd_target rs6000coff_vec =
},
/* Generic */
- bfd_true,
+ _bfd_archive_close_and_cleanup,
bfd_true,
coff_new_section_hook,
_bfd_generic_get_section_contents,
@@ -4332,7 +4332,7 @@ const bfd_target pmac_xcoff_vec =
},
/* Generic */
- bfd_true,
+ _bfd_archive_close_and_cleanup,
bfd_true,
coff_new_section_hook,
_bfd_generic_get_section_contents,
--
1.6.5.rc2