This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Assertion for a regression by gdb_bfd_unref
- From: Paul Pluzhnikov <ppluzhnikov at google dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Sun, 9 Aug 2009 20:14:44 -0700
- Subject: Re: [patch] Assertion for a regression by gdb_bfd_unref
- References: <20090809213710.GA14354@host0.dyn.jankratochvil.net>
On Sun, Aug 9, 2009 at 2:37 PM, Jan Kratochvil<jan.kratochvil@redhat.com> wrote:
> Going to post now patches to binutils for bfd/ to fix the bfd_usrdata
> initialization.
I thought I'd checked that it *is* initialized. In bfd/opncls.c:
/* Return a new BFD. All BFD's are allocated through this routine. */
bfd *
_bfd_new_bfd (void)
...
nbfd->usrdata = NULL;
Confused. Ah! bfd uses usrdata internally despite declaring them to be
for application use:
coff-stgo32.c:#define bfd_coff_go32stub bfd_usrdata
coff-stgo32.c: bfd_coff_go32stub (abfd) = (PTR) bfd_alloc (abfd,
(bfd_size_type) STUBSIZE);
How naughty!
> ? ? ? ?* objfiles.c (gdb_bfd_unref): Use the bfd_usrdata accessor.
> ? ? ? ?* solib.c (symbol_add_stub): Likewise.
> ? ? ? ?* symfile.c (symfile_bfd_open): Assert BFD_USRDATA is NULL.
Thanks for fixing this.
--
Paul Pluzhnikov