This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Use mmap for symbol tables
- From: Daniel Jacobowitz <drow at false dot org>
- To: Eirik Fuller <eirik at hackrat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 20 Feb 2006 10:52:17 -0500
- Subject: Re: [PATCH] Use mmap for symbol tables
- References: <20060131022330.GA24934@nevyn.them.org> <20060131033837.GA26401@nevyn.them.org> <20060207220534.46221690067@ns.hackrat.org>
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