This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Two memory management questions in BFD - link hash tables
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: binutils at sources dot redhat dot com
- Date: Sat, 30 Mar 2002 23:02:34 -0500
- Subject: Two memory management questions in BFD - link hash tables
With a little prod from Alan in the right direction, I've almost got GDB
relocating debug info on demand now. There's only one big problem
remaining... how to clean up afterwards.
In order to do this without poking around in bfd innards too much, I have to
use this sequence:
- create a dummy link info
- create a dummy hash table in the link info
- create a dummy link order
- set up all the needed output sections
- call bfd_canonicalize_symtab to get a list of symbols
- call bfd_get_relocated_section_contents
The problem is, there's no way to get rid of the hash table! It's
bfd_alloc'd, and bfd_release is private to BFD. I'm not sure I want to
violate that.
In addition, while I was doing this I noticed that a good chunk of the
bfd_link_hash_table_create implementations call free() rather than
bfd_release on error. If the hash table really should be bfd_alloc'd, I'll
fix those - but it might be preferable to bfd_malloc it instead.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer