From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4469 invoked by alias); 20 Feb 2006 15:52:21 -0000 Received: (qmail 4461 invoked by uid 22791); 20 Feb 2006 15:52:21 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Mon, 20 Feb 2006 15:52:19 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1FBDKj-0004MN-G1; Mon, 20 Feb 2006 10:52:17 -0500 Date: Mon, 20 Feb 2006 15:52:00 -0000 From: Daniel Jacobowitz To: Eirik Fuller Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Use mmap for symbol tables Message-ID: <20060220155217.GC16058@nevyn.them.org> Mail-Followup-To: Eirik Fuller , gdb-patches@sourceware.org References: <20060131022330.GA24934@nevyn.them.org> <20060131033837.GA26401@nevyn.them.org> <20060207220534.46221690067@ns.hackrat.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060207220534.46221690067@ns.hackrat.org> User-Agent: Mutt/1.5.8i X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-02/txt/msg00361.txt.bz2 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