From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 2B58E395B0B5 for ; Tue, 12 May 2020 21:09:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2B58E395B0B5 X-ASG-Debug-ID: 1589317756-0c856e18f31444b90001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id ggLXGl84HoiJyP4O (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 12 May 2020 17:09:16 -0400 (EDT) X-Barracuda-Envelope-From: simon.marchi@efficios.com X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from epycamd.internal.efficios.com (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) by smtp.ebox.ca (Postfix) with ESMTP id 06437441D67; Tue, 12 May 2020 17:09:16 -0400 (EDT) From: Simon Marchi X-Barracuda-Effective-Source-IP: 192-222-181-218.qc.cable.ebox.net[192.222.181.218] X-Barracuda-Apparent-Source-IP: 192.222.181.218 X-Barracuda-RBL-IP: 192.222.181.218 To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH v2 08/42] Add dwarf2_per_objfile field to dwarf2_cu Date: Tue, 12 May 2020 17:08:39 -0400 X-ASG-Orig-Subj: [PATCH v2 08/42] Add dwarf2_per_objfile field to dwarf2_cu Message-Id: <20200512210913.5593-9-simon.marchi@efficios.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200512210913.5593-1-simon.marchi@efficios.com> References: <20200512210913.5593-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1589317756 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 4858 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.81805 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Spam-Status: No, score=-30.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Tue, 12 May 2020 21:09:20 -0000 Subsequent patches will make dwarf2_per_cu_data objfile-independent. This means that the dwarf2_per_cu_data::dwarf2_per_objfile field must go. The code using a dwarf2_cu structure currently accesses the current dwarf2_per_objfile object through dwarf2_cu->per_cu->dwarf2_per_objfile. Since it's ok for the dwarf2_cu to know about the current objfile (a dwarf2_cu is always used in the context of a particular objfile), add a dwarf2_per_objfile field to dwarf2_cu. Upcoming patches will gradually remove uses of dwarf2_per_cu_data::dwarf2_per_objfile in favor of dwarf2_cu::dwarf2_per_objfile, until the former can be removed. gdb/ChangeLog: * dwarf2/read.c (struct dwarf2_cu) : Add parameter. : New member. (class cutu_reader) : Add parameter. (cutu_reader::init_tu_and_read_dwo_dies): Add parameter, update call to dwarf2_cu. (cutu_reader::cutu_reader): Update. (dwarf2_cu::dwarf2_cu): Add parameter, initialize per_objfile. --- gdb/dwarf2/read.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index c9617293284..096002219a3 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -399,7 +399,8 @@ struct delayed_method_info /* Internal state when decoding a particular compilation unit. */ struct dwarf2_cu { - explicit dwarf2_cu (struct dwarf2_per_cu_data *per_cu); + explicit dwarf2_cu (dwarf2_per_cu_data *per_cu, + dwarf2_per_objfile *per_objfile); ~dwarf2_cu (); DISABLE_COPY_AND_ASSIGN (dwarf2_cu); @@ -466,6 +467,9 @@ struct dwarf2_cu /* Backlink to our per_cu entry. */ struct dwarf2_per_cu_data *per_cu; + /* The dwarf2_per_objfile that owns this. */ + struct dwarf2_per_objfile *per_objfile; + /* How many compilation units ago was this CU last referenced? */ int last_used = 0; @@ -928,7 +932,8 @@ class cutu_reader : public die_reader_specs void keep (); private: - void init_tu_and_read_dwo_dies (struct dwarf2_per_cu_data *this_cu, + void init_tu_and_read_dwo_dies (dwarf2_per_cu_data *this_cu, + dwarf2_per_objfile *per_objfile, int use_existing_cu); struct dwarf2_per_cu_data *m_this_cu; @@ -6852,7 +6857,8 @@ lookup_dwo_unit (struct dwarf2_per_cu_data *this_cu, Read a TU directly from a DWO file, bypassing the stub. */ void -cutu_reader::init_tu_and_read_dwo_dies (struct dwarf2_per_cu_data *this_cu, +cutu_reader::init_tu_and_read_dwo_dies (dwarf2_per_cu_data *this_cu, + dwarf2_per_objfile *per_objfile, int use_existing_cu) { struct signatured_type *sig_type; @@ -6873,7 +6879,7 @@ cutu_reader::init_tu_and_read_dwo_dies (struct dwarf2_per_cu_data *this_cu, { /* If !use_existing_cu, this_cu->cu must be NULL. */ gdb_assert (this_cu->cu == NULL); - m_new_cu.reset (new dwarf2_cu (this_cu)); + m_new_cu.reset (new dwarf2_cu (this_cu, per_objfile)); } /* A future optimization, if needed, would be to use an existing @@ -6934,7 +6940,7 @@ cutu_reader::cutu_reader (struct dwarf2_per_cu_data *this_cu, /* Narrow down the scope of possibilities to have to understand. */ gdb_assert (this_cu->is_debug_types); gdb_assert (abbrev_table == NULL); - init_tu_and_read_dwo_dies (this_cu, use_existing_cu); + init_tu_and_read_dwo_dies (this_cu, dwarf2_per_objfile, use_existing_cu); return; } @@ -6961,7 +6967,7 @@ cutu_reader::cutu_reader (struct dwarf2_per_cu_data *this_cu, { /* If !use_existing_cu, this_cu->cu must be NULL. */ gdb_assert (this_cu->cu == NULL); - m_new_cu.reset (new dwarf2_cu (this_cu)); + m_new_cu.reset (new dwarf2_cu (this_cu, dwarf2_per_objfile)); cu = m_new_cu.get (); } @@ -7153,7 +7159,7 @@ cutu_reader::cutu_reader (struct dwarf2_per_cu_data *this_cu, /* This is cheap if the section is already read in. */ section->read (objfile); - m_new_cu.reset (new dwarf2_cu (this_cu)); + m_new_cu.reset (new dwarf2_cu (this_cu, dwarf2_per_objfile)); begin_info_ptr = info_ptr = section->buffer + to_underlying (this_cu->sect_off); info_ptr = read_and_check_comp_unit_head (dwarf2_per_objfile, @@ -23477,10 +23483,12 @@ run_test () #endif /* GDB_SELF_TEST */ -/* Initialize dwarf2_cu CU, owned by PER_CU. */ +/* Initialize dwarf2_cu to read PER_CU, in the context of PER_OBJFILE. */ -dwarf2_cu::dwarf2_cu (struct dwarf2_per_cu_data *per_cu_) - : per_cu (per_cu_), +dwarf2_cu::dwarf2_cu (dwarf2_per_cu_data *per_cu, + dwarf2_per_objfile *per_objfile) + : per_cu (per_cu), + per_objfile (per_objfile), mark (false), has_loclist (false), checked_producer (false), -- 2.26.2