From patchwork Thu Jan 23 00:56:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 37496 Received: (qmail 82580 invoked by alias); 23 Jan 2020 00:57:51 -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 80689 invoked by uid 89); 23 Jan 2020 00:57:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.1 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=HX-Languages-Length:2937 X-HELO: gateway23.websitewelcome.com Received: from gateway23.websitewelcome.com (HELO gateway23.websitewelcome.com) (192.185.50.185) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 23 Jan 2020 00:57:26 +0000 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 5BF975BC3 for ; Wed, 22 Jan 2020 18:57:25 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id uQoHizIEvERZguQoHirDCH; Wed, 22 Jan 2020 18:57:25 -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=PMDudHWXmCFRv7ZlUPZkVlAxEAt8sd4R8MBqcFYEaIg=; b=YxTQyFqx62ubjRY9uLwDVIg+5k aj1i4OU7+2T5cv+u754frB2rAaO+BlhTivPUfGdogy6FM+JhIKG/p25O5SCwlRkvV1oF9+oFfIS+f cHCHxNiVu/in1DyOQhikp2kgj; Received: from 75-166-123-50.hlrn.qwest.net ([75.166.123.50]:40828 helo=bapiya.Home) by box5379.bluehost.com with esmtpa (Exim 4.92) (envelope-from ) id 1iuQoH-004Kmd-6b; Wed, 22 Jan 2020 17:57:25 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 23/38] Change dwarf2_per_objfile::quick_file_names_table to htab_up Date: Wed, 22 Jan 2020 17:56:55 -0700 Message-Id: <20200123005710.7978-24-tom@tromey.com> In-Reply-To: <20200123005710.7978-1-tom@tromey.com> References: <20200123005710.7978-1-tom@tromey.com> This changes dwarf2_per_objfile::quick_file_names_table to be an htab_up. This just removes a bit of manual management. 2020-01-22 Tom Tromey * dwarf2/read.c (~dwarf2_per_objfile): Update. (create_quick_file_names_table): Return htab_up. (dw2_get_file_names_reader, dw2_forget_cached_source_info): Update. * dwarf2/read.h (struct dwarf2_per_objfile) : Now htab_up. Change-Id: I4ff2fce8b8af27f4bfe01a11b97a889edfd23151 --- gdb/ChangeLog | 9 +++++++++ gdb/dwarf2/read.c | 15 ++++++--------- gdb/dwarf2/read.h | 2 +- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 84c38eb04c7..7c59db56e22 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -2016,9 +2016,6 @@ dwarf2_per_objfile::~dwarf2_per_objfile () /* Cached DIE trees use xmalloc and the comp_unit_obstack. */ free_cached_comp_units (); - if (quick_file_names_table) - htab_delete (quick_file_names_table); - for (dwarf2_per_cu_data *per_cu : all_comp_units) per_cu->imported_symtabs_free (); @@ -2529,12 +2526,12 @@ delete_file_name_entry (void *e) /* Create a quick_file_names hash table. */ -static htab_t +static htab_up create_quick_file_names_table (unsigned int nr_initial_entries) { - return htab_create_alloc (nr_initial_entries, - hash_file_name_entry, eq_file_name_entry, - delete_file_name_entry, xcalloc, xfree); + return htab_up (htab_create_alloc (nr_initial_entries, + hash_file_name_entry, eq_file_name_entry, + delete_file_name_entry, xcalloc, xfree)); } /* Read in PER_CU->CU. This function is unrelated to symtabs, symtab would @@ -3370,7 +3367,7 @@ dw2_get_file_names_reader (const struct die_reader_specs *reader, If we have we're done. */ find_entry.hash.dwo_unit = cu->dwo_unit; find_entry.hash.line_sect_off = line_offset; - slot = htab_find_slot (dwarf2_per_objfile->quick_file_names_table, + slot = htab_find_slot (dwarf2_per_objfile->quick_file_names_table.get (), &find_entry, INSERT); if (*slot != NULL) { @@ -3494,7 +3491,7 @@ dw2_forget_cached_source_info (struct objfile *objfile) struct dwarf2_per_objfile *dwarf2_per_objfile = get_dwarf2_per_objfile (objfile); - htab_traverse_noresize (dwarf2_per_objfile->quick_file_names_table, + htab_traverse_noresize (dwarf2_per_objfile->quick_file_names_table.get (), dw2_free_cached_file_names, NULL); } diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index 92a5562e0e1..c3a53f65fe7 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -204,7 +204,7 @@ public: sorted all the TUs into "type unit groups", grouped by their DW_AT_stmt_list value. Therefore the only sharing done here is with a CU and its associated TU group if there is one. */ - htab_t quick_file_names_table {}; + htab_up quick_file_names_table; /* Set during partial symbol reading, to prevent queueing of full symbols. */