From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id pG1uGQ81o18EYQAAWB0awg (envelope-from ) for ; Wed, 04 Nov 2020 18:11:11 -0500 Received: by simark.ca (Postfix, from userid 112) id 5B67F1F08B; Wed, 4 Nov 2020 18:11:11 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED, MAILING_LIST_MULTI,T_DKIM_INVALID,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 5CA471E58F for ; Wed, 4 Nov 2020 18:11:10 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5DEF5394482E; Wed, 4 Nov 2020 23:11:09 +0000 (GMT) Received: from gateway20.websitewelcome.com (gateway20.websitewelcome.com [192.185.62.46]) by sourceware.org (Postfix) with ESMTPS id C77603883039 for ; Wed, 4 Nov 2020 23:11:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C77603883039 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway20.websitewelcome.com (Postfix) with ESMTP id 6D454400FBEAA for ; Wed, 4 Nov 2020 17:08:30 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id aRvgkHbt9YLDnaRvgkQiYL; Wed, 04 Nov 2020 17:11:00 -0600 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=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: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=VWpD2Tqwr/Rls12d4s17xZHhB/FCN8Hg8RPyD8gLt/M=; b=kJXKMYh/ehE8mvpyzFco/r2OT9 HtYf02Ew3Cg4A0w28p8uy1aByk7k0QCkMNs7wfQSqe0gvv/BHbgHpE1Ync/gZvq/UDcdddgc7ncSQ t2lxVX8s/FhAcVt1gOgMOb57R; Received: from 97-122-89-243.hlrn.qwest.net ([97.122.89.243]:47122 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1kaRvf-003Mez-RM; Wed, 04 Nov 2020 16:10:59 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH] Remove objfile parameter from abbrev_table::read Date: Wed, 4 Nov 2020 16:10:56 -0700 Message-Id: <20201104231056.30808-1-tom@tromey.com> X-Mailer: git-send-email 2.17.2 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.89.243 X-Source-L: No X-Exim-ID: 1kaRvf-003Mez-RM X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-89-243.hlrn.qwest.net (bapiya.Home) [97.122.89.243]:47122 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tom Tromey Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" In a longer series that I am working on, I needed to remove the objfile parameter from abbrev_table::read. It seemed to me that this was a simple and relatively harmless patch, so I'm sending it now. gdb/ChangeLog 2020-11-04 Tom Tromey * dwarf2/read.c (read_cutu_die_from_dwo) (cutu_reader::cutu_reader, cutu_reader::cutu_reader) (build_type_psymtabs_1): Update. * dwarf2/abbrev.h (struct abbrev_table): Remove objfile parameter. * dwarf2/abbrev.c (abbrev_table::read): Remove objfile parameter. Don't read section. --- gdb/ChangeLog | 10 ++++++++++ gdb/dwarf2/abbrev.c | 4 +--- gdb/dwarf2/abbrev.h | 7 +++++-- gdb/dwarf2/read.c | 16 ++++++++-------- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/gdb/dwarf2/abbrev.c b/gdb/dwarf2/abbrev.c index 86789e56bec..74a30e72a31 100644 --- a/gdb/dwarf2/abbrev.c +++ b/gdb/dwarf2/abbrev.c @@ -91,8 +91,7 @@ abbrev_table::add_abbrev (struct abbrev_info *abbrev) /* Read in an abbrev table. */ abbrev_table_up -abbrev_table::read (struct objfile *objfile, - struct dwarf2_section_info *section, +abbrev_table::read (struct dwarf2_section_info *section, sect_offset sect_off) { bfd *abfd = section->get_bfd_owner (); @@ -104,7 +103,6 @@ abbrev_table::read (struct objfile *objfile, abbrev_table_up abbrev_table (new struct abbrev_table (sect_off)); - section->read (objfile); abbrev_ptr = section->buffer + to_underlying (sect_off); abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); abbrev_ptr += bytes_read; diff --git a/gdb/dwarf2/abbrev.h b/gdb/dwarf2/abbrev.h index 888f04ebebb..d52d00b42bf 100644 --- a/gdb/dwarf2/abbrev.h +++ b/gdb/dwarf2/abbrev.h @@ -55,8 +55,11 @@ typedef std::unique_ptr abbrev_table_up; struct abbrev_table { - static abbrev_table_up read (struct objfile *objfile, - struct dwarf2_section_info *section, + /* Read an abbrev table from the indicated section, at the given + offset. The caller is responsible for ensuring that the section + has already been read. */ + + static abbrev_table_up read (struct dwarf2_section_info *section, sect_offset sect_off); /* Look up an abbrev in the table. diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 57db648061e..dbf0a3e25b9 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -6926,9 +6926,9 @@ read_cutu_die_from_dwo (dwarf2_cu *cu, dwo_unit->length = cu->header.get_length (); } + dwo_abbrev_section->read (objfile); *result_dwo_abbrev_table - = abbrev_table::read (objfile, dwo_abbrev_section, - cu->header.abbrev_sect_off); + = abbrev_table::read (dwo_abbrev_section, cu->header.abbrev_sect_off); init_cu_die_reader (result_reader, cu, section, dwo_unit->dwo_file, result_dwo_abbrev_table->get ()); @@ -7216,9 +7216,9 @@ cutu_reader::cutu_reader (dwarf2_per_cu_data *this_cu, gdb_assert (cu->header.abbrev_sect_off == abbrev_table->sect_off); else { + abbrev_section->read (objfile); m_abbrev_table_holder - = abbrev_table::read (objfile, abbrev_section, - cu->header.abbrev_sect_off); + = abbrev_table::read (abbrev_section, cu->header.abbrev_sect_off); abbrev_table = m_abbrev_table_holder.get (); } @@ -7360,9 +7360,9 @@ cutu_reader::cutu_reader (dwarf2_per_cu_data *this_cu, return; } + abbrev_section->read (objfile); m_abbrev_table_holder - = abbrev_table::read (objfile, abbrev_section, - m_new_cu->header.abbrev_sect_off); + = abbrev_table::read (abbrev_section, m_new_cu->header.abbrev_sect_off); init_cu_die_reader (this, m_new_cu.get (), section, dwo_file, m_abbrev_table_holder.get ()); @@ -7862,9 +7862,9 @@ build_type_psymtabs_1 (dwarf2_per_objfile *per_objfile) || tu.abbrev_offset != abbrev_offset) { abbrev_offset = tu.abbrev_offset; + per_objfile->per_bfd->abbrev.read (per_objfile->objfile); abbrev_table = - abbrev_table::read (per_objfile->objfile, - &per_objfile->per_bfd->abbrev, abbrev_offset); + abbrev_table::read (&per_objfile->per_bfd->abbrev, abbrev_offset); ++tu_stats->nr_uniq_abbrev_tables; } -- 2.17.2