This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: relent->sym_ptr_ptr memory stale refs question


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


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