This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: relent->sym_ptr_ptr memory stale refs question
- From: Alan Modra <amodra at gmail dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: binutils at sourceware dot org
- Date: Fri, 22 Oct 2010 00:16:10 +1030
- Subject: Re: relent->sym_ptr_ptr memory stale refs question
- References: <20101015095420.GA17502@host1.dyn.jankratochvil.net>
On Fri, Oct 15, 2010 at 11:54:20AM +0200, Jan Kratochvil wrote:
> Do you suggest a way to change the bfd/ API or is GDB free to use bfd_alloc?
Perhaps move objdump's slurp_symtab into bfd?
long
bfd_slurp_symtab (bfd *abfd, asymbol ***syms)
{
long storage;
*syms = NULL;
if (!(bfd_get_file_flags (abfd) & HAS_SYMS))
return 0;
storage = bfd_get_symtab_upper_bound (abfd);
if (storage < 0)
return storage;
if (storage)
{
*syms = (asymbol **) bfd_alloc (abfd, storage);
if (*syms == NULL)
return -1;
}
return bfd_canonicalize_symtab (abfd, *syms);
}
And something similar for slurp_dynamic_symtab.
--
Alan Modra
Australia Development Lab, IBM