From patchwork Thu Jan 23 00:56:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 37493 Received: (qmail 82270 invoked by alias); 23 Jan 2020 00:57:49 -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 80487 invoked by uid 89); 23 Jan 2020 00:57:33 -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= X-HELO: gateway22.websitewelcome.com Received: from gateway22.websitewelcome.com (HELO gateway22.websitewelcome.com) (192.185.47.125) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 23 Jan 2020 00:57:25 +0000 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway22.websitewelcome.com (Postfix) with ESMTP id DE0CB6769 for ; Wed, 22 Jan 2020 18:57:22 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id uQoEiNCXd9jb7uQoEiTpSV; 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=0OHj2aV8aMTVYkpOWdKeKYmNtnaBl0sJ9kW+cgdO/fo=; b=tmjFf3PSwp3P3+acFFBSVByDze ObGnnENTbk3yjH1NkTUyh+G+NeAcHjzhjLthLFvDYHcVkNbPT87dozZ/yBJqE6TrvUXGnYg9VbhFS pPX3Qzh/VUnYrjBS2T9eoRqdT; 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-Mw; Wed, 22 Jan 2020 17:57:22 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 16/38] Change dwarf2_per_objfile::line_header_hash to htab_up Date: Wed, 22 Jan 2020 17:56:48 -0700 Message-Id: <20200123005710.7978-17-tom@tromey.com> In-Reply-To: <20200123005710.7978-1-tom@tromey.com> References: <20200123005710.7978-1-tom@tromey.com> This changes dwarf2_per_objfile::line_header_hash to be an htab_up, and changes it to use heap allocation. gdb/ChangeLog 2020-01-22 Tom Tromey * dwarf2/read.c (~dwarf2_per_objfile): Don't delete line_header_hash. (handle_DW_AT_stmt_list): Update. Don't allocate on obstack. * dwarf2/read.h (struct dwarf2_per_objfile) : Change type to htab_up. Change-Id: Icb148a270838c0f96f38fc4a28b5b77d067927b6 --- gdb/ChangeLog | 8 ++++++++ gdb/dwarf2/read.c | 18 ++++++------------ gdb/dwarf2/read.h | 2 +- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 17f2640d0d4..844ff8dc54b 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -2019,9 +2019,6 @@ dwarf2_per_objfile::~dwarf2_per_objfile () if (quick_file_names_table) htab_delete (quick_file_names_table); - if (line_header_hash) - htab_delete (line_header_hash); - for (dwarf2_per_cu_data *per_cu : all_comp_units) per_cu->imported_symtabs_free (); @@ -11104,7 +11101,6 @@ handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu, { struct dwarf2_per_objfile *dwarf2_per_objfile = cu->per_cu->dwarf2_per_objfile; - struct objfile *objfile = dwarf2_per_objfile->objfile; struct attribute *attr; struct line_header line_header_local; hashval_t line_header_local_hash; @@ -11129,12 +11125,10 @@ handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu, && die->tag == DW_TAG_partial_unit) { dwarf2_per_objfile->line_header_hash - = htab_create_alloc_ex (127, line_header_hash_voidp, - line_header_eq_voidp, - free_line_header_voidp, - &objfile->objfile_obstack, - hashtab_obstack_allocate, - dummy_obstack_deallocate); + .reset (htab_create_alloc (127, line_header_hash_voidp, + line_header_eq_voidp, + free_line_header_voidp, + xcalloc, xfree)); } line_header_local.sect_off = line_offset; @@ -11142,7 +11136,7 @@ handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu, line_header_local_hash = line_header_hash (&line_header_local); if (dwarf2_per_objfile->line_header_hash != NULL) { - slot = htab_find_slot_with_hash (dwarf2_per_objfile->line_header_hash, + slot = htab_find_slot_with_hash (dwarf2_per_objfile->line_header_hash.get (), &line_header_local, line_header_local_hash, NO_INSERT); @@ -11170,7 +11164,7 @@ handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu, slot = NULL; else { - slot = htab_find_slot_with_hash (dwarf2_per_objfile->line_header_hash, + slot = htab_find_slot_with_hash (dwarf2_per_objfile->line_header_hash.get (), &line_header_local, line_header_local_hash, INSERT); gdb_assert (slot != NULL); diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index 9787127f99e..91d5c58faa0 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -219,7 +219,7 @@ public: std::vector just_read_cus; /* Table containing line_header indexed by offset and offset_in_dwz. */ - htab_t line_header_hash {}; + htab_up line_header_hash; /* Table containing all filenames. This is an optional because the table is lazily constructed on first access. */