From patchwork Thu Jan 23 00:56:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 37486 Received: (qmail 80721 invoked by alias); 23 Jan 2020 00:57:36 -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 79996 invoked by uid 89); 23 Jan 2020 00:57:30 -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: gateway30.websitewelcome.com Received: from gateway30.websitewelcome.com (HELO gateway30.websitewelcome.com) (192.185.198.26) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 23 Jan 2020 00:57:23 +0000 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 540A4513C for ; Wed, 22 Jan 2020 18:57:22 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id uQoEi9YzyiJ43uQoEiNKP3; Wed, 22 Jan 2020 18:57:22 -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=+H8knfYEBnRcCoBxSUdytIBsyqobzApgOxjMYdZ0CY0=; b=k+Vhqrgyii6MjCL8tGswRsNg7z AS6kIknR04uJVPza9PPfnchGaPd4U52MikO+yDkmymdT27/mHs6w+yp9CgdSOgUbu5EuJskiIW9uI IlDDV13G6Efn7tq5wheQszHaS; 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 1iuQoE-004Kis-4w; Wed, 22 Jan 2020 17:57:22 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 15/38] Change dwarf2_per_objfile::type_unit_groups to htab_up Date: Wed, 22 Jan 2020 17:56:47 -0700 Message-Id: <20200123005710.7978-16-tom@tromey.com> In-Reply-To: <20200123005710.7978-1-tom@tromey.com> References: <20200123005710.7978-1-tom@tromey.com> This changes dwarf2_per_objfile::type_unit_groups to be an htab_up, again allowing us to move the memory used by the hash table from the objfile obstack to the heap. gdb/ChangeLog 2020-01-22 Tom Tromey * dwarf2/read.c (allocate_type_unit_groups_table): Return htab_up. Don't allocate on obstack. (get_type_unit_group, dwarf2_build_psymtabs_hard): Update. * dwarf2/read.h (struct dwarf2_per_objfile) : Change type to htab_up. Change-Id: Ia045df0ff3ec30aac813da5a9a2314a607ef7ec8 --- gdb/ChangeLog | 8 ++++++++ gdb/dwarf2/read.c | 17 +++++++---------- gdb/dwarf2/read.h | 2 +- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 10cbc7bd231..17f2640d0d4 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -7527,16 +7527,13 @@ eq_type_unit_group (const void *item_lhs, const void *item_rhs) /* Allocate a hash table for type unit groups. */ -static htab_t +static htab_up allocate_type_unit_groups_table (struct objfile *objfile) { - return htab_create_alloc_ex (3, - hash_type_unit_group, - eq_type_unit_group, - NULL, - &objfile->objfile_obstack, - hashtab_obstack_allocate, - dummy_obstack_deallocate); + return htab_up (htab_create_alloc (3, + hash_type_unit_group, + eq_type_unit_group, + NULL, xcalloc, xfree)); } /* Type units that don't have DW_AT_stmt_list are grouped into their own @@ -7632,7 +7629,7 @@ get_type_unit_group (struct dwarf2_cu *cu, const struct attribute *stmt_list) type_unit_group_for_lookup.hash.dwo_unit = cu->dwo_unit; type_unit_group_for_lookup.hash.line_sect_off = (sect_offset) line_offset; - slot = htab_find_slot (dwarf2_per_objfile->type_unit_groups, + slot = htab_find_slot (dwarf2_per_objfile->type_unit_groups.get (), &type_unit_group_for_lookup, INSERT); if (*slot != NULL) { @@ -8201,7 +8198,7 @@ dwarf2_build_psymtabs_hard (struct dwarf2_per_objfile *dwarf2_per_objfile) /* Now that all TUs have been processed we can fill in the dependencies. */ if (dwarf2_per_objfile->type_unit_groups != NULL) { - htab_traverse_noresize (dwarf2_per_objfile->type_unit_groups, + htab_traverse_noresize (dwarf2_per_objfile->type_unit_groups.get (), build_type_psymtab_dependencies, dwarf2_per_objfile); } diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index 33ecb4a5911..9787127f99e 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -152,7 +152,7 @@ public: /* Table of struct type_unit_group objects. The hash key is the DW_AT_stmt_list value. */ - htab_t type_unit_groups {}; + htab_up type_unit_groups; /* A table mapping .debug_types signatures to its signatured_type entry. This is NULL if the .debug_types section hasn't been read in yet. */