From patchwork Sun Jan 26 23:41:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 37555 Received: (qmail 40673 invoked by alias); 26 Jan 2020 23:41:18 -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 40553 invoked by uid 89); 26 Jan 2020 23:41:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=ownership, transfers X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 26 Jan 2020 23:41:15 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id 0F48620A8B; Sun, 26 Jan 2020 18:41:14 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [IPv6:2620:52:3:1:5054:ff:fe06:16ca]) by mx1.osci.io (Postfix) with ESMTP id 0446420577; Sun, 26 Jan 2020 18:41:09 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id ECDEE20AF7; Sun, 26 Jan 2020 18:41:08 -0500 (EST) X-Gerrit-PatchSet: 2 Date: Sun, 26 Jan 2020 18:41:08 -0500 From: "Sourceware to Gerrit sync (Code Review)" To: Tom Tromey , gdb-patches@sourceware.org Auto-Submitted: auto-generated X-Gerrit-MessageType: merged Subject: [pushed] Do not allocate psymtabs via psymtab_storage X-Gerrit-Change-Id: Iba6a9bf3ee1e78062fdb9f007c3010f826f64bc8 X-Gerrit-Change-Number: 376 X-Gerrit-ChangeURL: X-Gerrit-Commit: abaa2f2340a400fd19aea2973f705fe813d620d4 In-Reply-To: References: Reply-To: noreply@gnutoolchain-gerrit.osci.io, tromey@sourceware.org, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Message-Id: <20200126234108.ECDEE20AF7@gnutoolchain-gerrit.osci.io> Sourceware to Gerrit sync has submitted this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/376 ...................................................................... Do not allocate psymtabs via psymtab_storage Currently, partial symbol tables are allocated by a method in psymtab_storage. However, eventually we want to subclass partial symtabs in the symbol readers, so the calls to "new" will have to happen there. This patch is a first step, moving the allocation from psymtab_storage and into allocate_psymtab. gdb/ChangeLog 2020-01-26 Tom Tromey * psymtab.h (class psymtab_storage) : Rename from allocate_psymtab. Update documentation. * psymtab.c (psymtab_storage::install_psymtab): Rename from allocate_psymtab. Do not use new. (allocate_psymtab): Use new. Update. Change-Id: Iba6a9bf3ee1e78062fdb9f007c3010f826f64bc8 --- M gdb/ChangeLog M gdb/psymtab.c M gdb/psymtab.h 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 345a81c..475ebbb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2020-01-26 Tom Tromey + * psymtab.h (class psymtab_storage) : Rename from + allocate_psymtab. Update documentation. + * psymtab.c (psymtab_storage::install_psymtab): Rename from + allocate_psymtab. Do not use new. + (allocate_psymtab): Use new. Update. + +2020-01-26 Tom Tromey + * xcoffread.c (xcoff_psymtab_to_symtab_1): Update. * psymtab.c (psym_print_stats): Update. * psympriv.h (struct partial_symtab) next = psymtabs; - psymtabs = psymtab; - - return psymtab; + pst->next = psymtabs; + psymtabs = pst; } @@ -1653,8 +1649,8 @@ struct partial_symtab * allocate_psymtab (const char *filename, struct objfile *objfile) { - struct partial_symtab *psymtab - = objfile->partial_symtabs->allocate_psymtab (); + struct partial_symtab *psymtab = new partial_symtab; + objfile->partial_symtabs->install_psymtab (psymtab); psymtab->filename = ((const char *) objfile->per_bfd->filename_cache.insert diff --git a/gdb/psymtab.h b/gdb/psymtab.h index c0f0a97..d665474 100644 --- a/gdb/psymtab.h +++ b/gdb/psymtab.h @@ -83,11 +83,10 @@ return OBSTACK_CALLOC (obstack (), number, struct partial_symtab *); } - /* Allocate a new psymtab on the psymtab obstack. The new psymtab - will be linked in to the "psymtabs" list, but otherwise all other - fields will be zero. */ + /* Install a psymtab on the psymtab list. This transfers ownership + of PST to this object. */ - struct partial_symtab *allocate_psymtab (); + void install_psymtab (partial_symtab *pst); typedef next_adapter partial_symtab_range;