From patchwork Thu Jan 23 00:56:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 37488 Received: (qmail 81856 invoked by alias); 23 Jan 2020 00:57:46 -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 80341 invoked by uid 89); 23 Jan 2020 00:57:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.0 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.1 spammy= X-HELO: gateway32.websitewelcome.com Received: from gateway32.websitewelcome.com (HELO gateway32.websitewelcome.com) (192.185.145.119) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 23 Jan 2020 00:57:25 +0000 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway32.websitewelcome.com (Postfix) with ESMTP id 66D3D364D0B4 for ; Wed, 22 Jan 2020 18:57:23 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id uQoFi9Z0jiJ43uQoFiNKPp; Wed, 22 Jan 2020 18:57:23 -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=wVpYoKFKZczkuI2x0i35qbTO2pOCgT/P/zU7jpQCShM=; b=CrQueuxUAB3DURO3hoY6MMNhMh PJ101nsCfaZvWLqTDU9rYeFAdWFlO9ocIpLARFZQ8VS2kPhwImoVR3lGrnAbHXzaPZMOWLZeRjcI0 Lp07Ajf8icwqnrU9N2yBWm5sm; Received: from 75-166-123-50.hlrn.qwest.net ([75.166.123.50]:40826 helo=bapiya.Home) by box5379.bluehost.com with esmtpa (Exim 4.92) (envelope-from ) id 1iuQoF-004Kis-6y; Wed, 22 Jan 2020 17:57:23 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 18/38] Change dwp_file to use htab_up Date: Wed, 22 Jan 2020 17:56:50 -0700 Message-Id: <20200123005710.7978-19-tom@tromey.com> In-Reply-To: <20200123005710.7978-1-tom@tromey.com> References: <20200123005710.7978-1-tom@tromey.com> This changes dwp_file to use htab_up for the loaded_cus and loaded_tus members. This lets us avoid allocating the contents of these hash tables on the objfile obstack. gdb/ChangeLog 2020-01-22 Tom Tromey * dwarf2/read.c (struct dwp_file) : Now htab_up. (lookup_dwo_unit_in_dwp): Update. (allocate_dwp_loaded_cutus_table): Return htab_up. Don't allocate on obstack. Change-Id: Id61209bf5c6c6faa0c067195af31fbcf26813a3a --- gdb/ChangeLog | 8 ++++++++ gdb/dwarf2/read.c | 21 +++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 2f87b9d2a50..5becbd5ef9b 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -868,8 +868,8 @@ struct dwp_file const struct dwp_hash_table *tus = nullptr; /* Tables of loaded CUs/TUs. Each entry is a struct dwo_unit *. */ - htab_t loaded_cus {}; - htab_t loaded_tus {}; + htab_up loaded_cus; + htab_up loaded_tus; /* Table to map ELF section numbers to their sections. This is only needed for the DWP V1 file format. */ @@ -12395,8 +12395,8 @@ lookup_dwo_unit_in_dwp (struct dwarf2_per_objfile *dwarf2_per_objfile, memset (&find_dwo_cu, 0, sizeof (find_dwo_cu)); find_dwo_cu.signature = signature; slot = htab_find_slot (is_debug_types - ? dwp_file->loaded_tus - : dwp_file->loaded_cus, + ? dwp_file->loaded_tus.get () + : dwp_file->loaded_cus.get (), &find_dwo_cu, INSERT); if (*slot != NULL) @@ -12767,16 +12767,13 @@ eq_dwp_loaded_cutus (const void *a, const void *b) /* Allocate a hash table for dwp_file loaded CUs/TUs. */ -static htab_t +static htab_up allocate_dwp_loaded_cutus_table (struct objfile *objfile) { - return htab_create_alloc_ex (3, - hash_dwp_loaded_cutus, - eq_dwp_loaded_cutus, - NULL, - &objfile->objfile_obstack, - hashtab_obstack_allocate, - dummy_obstack_deallocate); + return htab_up (htab_create_alloc (3, + hash_dwp_loaded_cutus, + eq_dwp_loaded_cutus, + NULL, xcalloc, xfree)); } /* Try to open DWP file FILE_NAME.