This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Assertion for a regression by gdb_bfd_unref


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]