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] Use mmap for symbol tables


Still catching up on mail, as usual... sorry about the delay.

On Tue, Feb 07, 2006 at 02:05:34PM -0800, Eirik Fuller wrote:
> One assumption in this revised patch which I haven't fully validated
> is that it makes sense to free the obstack_alloc'd buf if bfd_fetch
> returns a non-NULL value.  I figure if symfile_relocate_debug_section
> returns NULL, either there were no subsequent calls to obstack_alloc,
> or nothing allocated by obstack_alloc after buf matters any more.

This is a bad, bad, bad assumption.  Cases where it's proper to use
obstack_free are few and far between, and they often make me go "then
why did we bother to allocate it?".  It would probably be better
to do this in symfile_relocate_debug_section, and let it allocate
the buffer.  You can do this by passing an obstack (possibly NULL)
to symfile_relocate_debug_section, instead of a buffer (possibly NULL).

> I'm
> sure there's a cleaner way to approach this (which almost certainly
> requires a bit more complication in the patch), but if the mmap calls
> are eventually per-section in the BFD code (due to other complications
> in the patch) instead of covering an entire file, this piece of the
> patch will presumably look very different anyway.

Probably true.

-- 
Daniel Jacobowitz
CodeSourcery


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