From patchwork Sun Nov 25 19:20:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 30296 Received: (qmail 29730 invoked by alias); 25 Nov 2018 19:20:55 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 29569 invoked by uid 89); 25 Nov 2018 19:20:53 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:3375 X-HELO: gateway22.websitewelcome.com Received: from gateway22.websitewelcome.com (HELO gateway22.websitewelcome.com) (192.185.46.126) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 25 Nov 2018 19:20:50 +0000 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway22.websitewelcome.com (Postfix) with ESMTP id E80EBB7B1 for ; Sun, 25 Nov 2018 13:20:48 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id QzxYg4gOTaSeyQzxYgHlXs; Sun, 25 Nov 2018 13:20:48 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=msjMR9BpmzO/ECAfy3siUSP/6PyjKGSGGUSvkzlk6AM=; b=Q4nXQcU58Q/FJxF4sIPzZEgkF5 bhdfjQsURH9tCt5NGtktf8+sysYkh2nQL0ezDSbBOrFS35kkxVEx2SItfSNbNbtWZxF+1OPRWIrO0 eTzRlMShsqKq3AlH8D1I1wSz1; Received: from 97-122-190-66.hlrn.qwest.net ([97.122.190.66]:52060 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gQzxY-001TOx-Nj; Sun, 25 Nov 2018 13:20:48 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v2 08/12] Allocate the address map on the psymtab obstack Date: Sun, 25 Nov 2018 12:20:39 -0700 Message-Id: <20181125192043.8405-9-tom@tromey.com> In-Reply-To: <20181125192043.8405-1-tom@tromey.com> References: <20181125192043.8405-1-tom@tromey.com> After this patch, the psymtab address map will now be allocated on the psymtab obstack rather than the objfile obstack. This also changes the psymtab storage object to make the obstack private; this will be used later. gdb/ChangeLog 2018-11-25 Tom Tromey * psymtab.h (psymtab_storage::obstack): New method. : Rename from obstack; now private. * psymtab.c (psymtab_storage): Update. * dwarf2read.c (create_addrmap_from_index) (create_addrmap_from_aranges, dwarf2_build_psymtabs_hard): Update. --- gdb/ChangeLog | 9 +++++++++ gdb/dwarf2read.c | 6 +++--- gdb/psymtab.c | 4 ++-- gdb/psymtab.h | 17 +++++++++++++---- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 26fc47b669..35717aa6a3 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -3191,7 +3191,7 @@ create_addrmap_from_index (struct dwarf2_per_objfile *dwarf2_per_objfile, } objfile->partial_symtabs->psymtabs_addrmap - = addrmap_create_fixed (mutable_map, &objfile->objfile_obstack); + = addrmap_create_fixed (mutable_map, objfile->partial_symtabs->obstack ()); } /* Read the address map data from DWARF-5 .debug_aranges, and use it to @@ -3352,7 +3352,7 @@ create_addrmap_from_aranges (struct dwarf2_per_objfile *dwarf2_per_objfile, } objfile->partial_symtabs->psymtabs_addrmap - = addrmap_create_fixed (mutable_map, &objfile->objfile_obstack); + = addrmap_create_fixed (mutable_map, objfile->partial_symtabs->obstack ()); } /* Find a slot in the mapped index INDEX for the object named NAME. @@ -8485,7 +8485,7 @@ dwarf2_build_psymtabs_hard (struct dwarf2_per_objfile *dwarf2_per_objfile) objfile->partial_symtabs->psymtabs_addrmap = addrmap_create_fixed (objfile->partial_symtabs->psymtabs_addrmap, - &objfile->objfile_obstack); + objfile->partial_symtabs->obstack ()); /* At this point we want to keep the address map. */ save_psymtabs_addrmap.release (); diff --git a/gdb/psymtab.c b/gdb/psymtab.c index c06ff0c70e..d4152bdba4 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -68,8 +68,8 @@ static struct compunit_symtab *psymtab_to_symtab (struct objfile *objfile, psymtab_storage::psymtab_storage (struct objfile *objfile) - : obstack (&objfile->objfile_obstack), - psymbol_cache (psymbol_bcache_init ()) + : psymbol_cache (psymbol_bcache_init ()), + m_obstack (&objfile->objfile_obstack) { } diff --git a/gdb/psymtab.h b/gdb/psymtab.h index 7bdb9d185f..d0b446b5ed 100644 --- a/gdb/psymtab.h +++ b/gdb/psymtab.h @@ -54,6 +54,13 @@ public: void discard_psymtab (struct partial_symtab *pst); + /* Return the obstack that is used for storage by this object. */ + + struct obstack *obstack () + { + return m_obstack; + } + /* Each objfile points to a linked list of partial symtabs derived from this file, one partial symtab structure for each compilation unit @@ -72,10 +79,6 @@ public: struct partial_symtab *free_psymtabs = nullptr; - /* The obstack where allocations are made. */ - - struct obstack *obstack; - /* A byte cache where we can stash arbitrary "chunks" of bytes that will not change. */ @@ -86,6 +89,12 @@ public: std::vector global_psymbols; std::vector static_psymbols; + +private: + + /* The obstack where allocations are made. */ + + struct obstack *m_obstack; };