From patchwork Fri Jun 21 11:58:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 33251 Received: (qmail 82244 invoked by alias); 21 Jun 2019 12:05:38 -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 82236 invoked by uid 89); 21 Jun 2019 12:05:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=UD:info X-HELO: mail.efficios.com Received: from mail.efficios.com (HELO mail.efficios.com) (167.114.142.138) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 21 Jun 2019 12:05:36 +0000 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id C915B259D0B; Fri, 21 Jun 2019 07:58:33 -0400 (EDT) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id dtcgFsqjljje; Fri, 21 Jun 2019 07:58:33 -0400 (EDT) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id C85E0259CF6; Fri, 21 Jun 2019 07:58:30 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com C85E0259CF6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1561118310; bh=GYlt1BcqQ+GbY71/JMW2vKw0BGkhHpeqjMeXzimAAJY=; h=From:To:Date:Message-Id:MIME-Version; b=ZSZxmvmoBAVkyjpS3gk5BtcOE6QlSytJ7wgQPsAuJR8pIi1Jd3AiS1F5bNJT4NAlB dWkRYebuFf0uLfgdVQclH+Bvn0PzI2ogPYCp4FSRx1coUjReBM9TcYaWfBUm/4EShx jkApBXI4A57QgTr+HtZCZQM8g8CuSHdKk3RxMNTTAdJGu03XXpKXgPlRvFIBoWXFgQ 3mmfkCvsNqz1EDOaPMO7mDUgunMaZQcK0S9uzXmIctyGCUB8K1Ut65DqnymsDihFFg pfwN+UXid/SCfRCFGOzY6a0CIXtqNhiHiMqU8t7ROAJ9+AVkJNi/mjCVFhwMow4Idl iiHT+jYjowiiQ== Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id pE3essUoutYT; Fri, 21 Jun 2019 07:58:30 -0400 (EDT) Received: from smarchi-efficios.internal.efficios.com (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) by mail.efficios.com (Postfix) with ESMTPSA id 8775A259CE0; Fri, 21 Jun 2019 07:58:30 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 3/4] dwarf2read: Make dwo_file::dbfd a gdb_bfd_ref_ptr Date: Fri, 21 Jun 2019 07:58:15 -0400 Message-Id: <20190621115816.14841-4-simon.marchi@efficios.com> In-Reply-To: <20190621115816.14841-1-simon.marchi@efficios.com> References: <20190621115816.14841-1-simon.marchi@efficios.com> MIME-Version: 1.0 From: Simon Marchi This removes the manual call to gdb_bfd_ref in favor of gdb_bfd_ref_ptr. gdb/ChangeLog: * dwarf2read.c (struct dwo_file) : Change type to gdb_bfd_ref_ptr. <~dwo_file>: Remove call to gdb_bfd_unref. (open_and_init_dwo_file): Move gdb_bfd_ref_ptr into dbfd field. Call gdb_bfd_ref_ptr::get. --- gdb/dwarf2read.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index c73ab6367da9..05c872017066 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -708,8 +708,6 @@ struct dwo_file ~dwo_file () { - gdb_bfd_unref (dbfd); - VEC_free (dwarf2_section_info_def, sections.types); } @@ -724,7 +722,7 @@ struct dwo_file /* The bfd, when the file is open. Otherwise this is NULL. This is unused(NULL) for virtual DWO files where we use dwp_file.dbfd. */ - bfd *dbfd = nullptr; + gdb_bfd_ref_ptr dbfd; /* The sections that make up this DWO file. Remember that for virtual DWO files in DWP V2, these are virtual @@ -12960,7 +12958,7 @@ open_and_init_dwo_file (struct dwarf2_per_cu_data *per_cu, { struct dwarf2_per_objfile *dwarf2_per_objfile = per_cu->dwarf2_per_objfile; - gdb_bfd_ref_ptr dbfd (open_dwo_file (dwarf2_per_objfile, dwo_name, comp_dir)); + gdb_bfd_ref_ptr dbfd = open_dwo_file (dwarf2_per_objfile, dwo_name, comp_dir); if (dbfd == NULL) { if (dwarf_read_debug) @@ -12971,9 +12969,9 @@ open_and_init_dwo_file (struct dwarf2_per_cu_data *per_cu, dwo_file_up dwo_file (new struct dwo_file); dwo_file->dwo_name = dwo_name; dwo_file->comp_dir = comp_dir; - dwo_file->dbfd = dbfd.release (); + dwo_file->dbfd = std::move (dbfd); - bfd_map_over_sections (dwo_file->dbfd, dwarf2_locate_dwo_sections, + bfd_map_over_sections (dwo_file->dbfd.get (), dwarf2_locate_dwo_sections, &dwo_file->sections); create_cus_hash_table (dwarf2_per_objfile, *dwo_file, dwo_file->sections.info,