From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69723 invoked by alias); 28 Oct 2019 02:03:24 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 69696 invoked by uid 89); 28 Oct 2019 02:03:24 -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=Install, sk:partial 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; Mon, 28 Oct 2019 02:03:22 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id 4E42121254; Sun, 27 Oct 2019 22:03:20 -0400 (EDT) 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 A93AA21082 for ; Sun, 27 Oct 2019 22:03:17 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 7278F2A7D9 for ; Sun, 27 Oct 2019 22:03:17 -0400 (EDT) X-Gerrit-PatchSet: 1 Date: Mon, 28 Oct 2019 02:03:00 -0000 From: "Tom Tromey (Code Review)" To: gdb-patches@sourceware.org Message-ID: Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange Subject: [review] Do not allocate psymtabs via psymtab_storage X-Gerrit-Change-Id: Iba6a9bf3ee1e78062fdb9f007c3010f826f64bc8 X-Gerrit-Change-Number: 376 X-Gerrit-ChangeURL: X-Gerrit-Commit: ec2969a5c20387dddc25bcc26f7b97b95a0a6418 References: Reply-To: tromey@sourceware.org, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/3.0.3-74-g460fb0f7e9 Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2019-10/txt/msg00973.txt.bz2 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 2019-10-27 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 c2831e7..6cfcad9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2019-10-27 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. + +2019-10-27 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; } @@ -1655,8 +1651,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 d748695..80a5fc5 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; -- Gerrit-Project: binutils-gdb Gerrit-Branch: master Gerrit-Change-Id: Iba6a9bf3ee1e78062fdb9f007c3010f826f64bc8 Gerrit-Change-Number: 376 Gerrit-PatchSet: 1 Gerrit-Owner: Tom Tromey Gerrit-MessageType: newchange