From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32017 invoked by alias); 11 Sep 2003 23:28:36 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 32007 invoked from network); 11 Sep 2003 23:28:36 -0000 Received: from unknown (HELO hawaii.kealia.com) (209.3.10.89) by sources.redhat.com with SMTP; 11 Sep 2003 23:28:36 -0000 Received: by hawaii.kealia.com (Postfix, from userid 2049) id 77984CB29; Thu, 11 Sep 2003 16:28:35 -0700 (PDT) To: Elena Zannoni Cc: gdb-patches@sources.redhat.com Subject: [rfa] use allocate_block more From: David Carlton Date: Thu, 11 Sep 2003 23:28:00 -0000 In-Reply-To: <16222.12105.616302.481564@localhost.redhat.com> (Elena Zannoni's message of "Tue, 9 Sep 2003 15:51:37 -0400") Message-ID: User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Rational FORTRAN, linux) References: <20030622173547.GA22603@nevyn.them.org> <20030624185019.GA24662@nevyn.them.org> <16222.12105.616302.481564@localhost.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-09/txt/msg00253.txt.bz2 On Tue, 9 Sep 2003 15:51:37 -0400, Elena Zannoni said: > I think it would make sense, in a next pass, to have all the creation > of blocks go through the new function. Well, I was planning to do that; here's what I came up with instead. The problem is that mdebugread.c currently doesn't allocate blocks on an obstack at all! That should presumably be fixed ("rm mdebugread.c" would be my preferred method), but I didn't feel like doing that right now; I'd rather leave it up to somebody with access to a machine using mdebugread. Tested on i686-pc-linux-gnu, GCC 3.2, DWARF 2; no new regressions. OK to commit? David Carlton carlton@kealia.com 2003-09-11 David Carlton * buildsym.c (finish_block): Use allocate_block to allocate the block. * mdebugread.c (new_block): Add FIXME. Index: buildsym.c =================================================================== RCS file: /cvs/src/src/gdb/buildsym.c,v retrieving revision 1.33 diff -u -p -r1.33 buildsym.c --- buildsym.c 11 Jun 2003 23:29:46 -0000 1.33 +++ buildsym.c 11 Sep 2003 22:58:08 -0000 @@ -231,19 +231,15 @@ finish_block (struct symbol *symbol, str register struct pending_block *pblock; struct pending_block *opblock; - /* Initialize the block's dictionary. */ + block = allocate_block (&objfile->symbol_obstack); if (symbol) { - block = (struct block *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct block)); BLOCK_DICT (block) = dict_create_linear (&objfile->symbol_obstack, *listhead); } else { - block = (struct block *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct block)); BLOCK_DICT (block) = dict_create_hashed (&objfile->symbol_obstack, *listhead); } Index: mdebugread.c =================================================================== RCS file: /cvs/src/src/gdb/mdebugread.c,v retrieving revision 1.47 diff -u -p -r1.47 mdebugread.c --- mdebugread.c 11 Jun 2003 23:29:47 -0000 1.47 +++ mdebugread.c 11 Sep 2003 22:58:14 -0000 @@ -4696,6 +4696,9 @@ new_bvect (int nblocks) static struct block * new_block (enum block_type type) { + /* FIXME: carlton/2003-09-11: This should use allocate_block to + allocate the block. Which, in turn, suggests that the block + should be allocated on an obstack. */ struct block *retval = xzalloc (sizeof (struct block)); if (type == FUNCTION_BLOCK)