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 BC26B396DC20 for ; Tue, 12 May 2020 21:15:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BC26B396DC20 X-ASG-Debug-ID: 1589318118-0c856e314b8937d0001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id ArZMLZ3IfHitDjer (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 12 May 2020 17:15:18 -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 BAA2D441B21; Tue, 12 May 2020 17:15:18 -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 29/42] Add dwarf2_per_objfile parameter to free_one_cached_comp_unit Date: Tue, 12 May 2020 17:12:37 -0400 X-ASG-Orig-Subj: [PATCH v2 29/42] Add dwarf2_per_objfile parameter to free_one_cached_comp_unit Message-Id: <20200512211250.6230-30-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: 1589318118 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: 8292 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=-26.2 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:15:22 -0000 This allows removing some references to dwarf2_per_cu_data::dwarf2_per_objfile. gdb/ChangeLog: * dwarf2/read.h (struct dwarf2_queue_item): Add dwarf2_per_objfile parameter, assign new parameter. : New field. * dwarf2/read.c (free_one_cached_comp_unit): Add dwarf2_per_objfile parameter. (queue_comp_unit): Likewise. (dw2_do_instantiate_symtab): Update. (process_psymtab_comp_unit): Update. (maybe_queue_comp_unit): Add dwarf2_per_objfile parameter. (process_imported_unit_die): Update. (queue_and_load_dwo_tu): Update. (follow_die_offset): Update. (follow_die_sig_1): Update. --- gdb/dwarf2/read.c | 42 +++++++++++++++++++++++------------------- gdb/dwarf2/read.h | 7 +++++-- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 63449cf2c6f..e8ba115fe4f 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -1568,7 +1568,8 @@ static void prepare_one_comp_unit (struct dwarf2_cu *cu, static void age_cached_comp_units (struct dwarf2_per_objfile *dwarf2_per_objfile); -static void free_one_cached_comp_unit (struct dwarf2_per_cu_data *); +static void free_one_cached_comp_unit (dwarf2_per_cu_data *target_per_cu, + dwarf2_per_objfile *per_objfile); static struct type *set_die_type (struct die_info *, struct type *, struct dwarf2_cu *); @@ -1602,7 +1603,8 @@ static struct type *get_die_type_at_offset (sect_offset, static struct type *get_die_type (struct die_info *die, struct dwarf2_cu *cu); -static void queue_comp_unit (struct dwarf2_per_cu_data *per_cu, +static void queue_comp_unit (dwarf2_per_cu_data *per_cu, + dwarf2_per_objfile *per_objfile, enum language pretend_language); static void process_queue (struct dwarf2_per_objfile *dwarf2_per_objfile); @@ -1642,7 +1644,7 @@ dwarf2_queue_item::~dwarf2_queue_item () if (per_cu->queued) { if (per_cu->cu != NULL) - free_one_cached_comp_unit (per_cu); + free_one_cached_comp_unit (per_cu, per_objfile); per_cu->queued = 0; } } @@ -2381,7 +2383,7 @@ dw2_do_instantiate_symtab (dwarf2_per_cu_data *per_cu, if (!dwarf2_per_objfile->symtab_set_p (per_cu)) { - queue_comp_unit (per_cu, language_minimal); + queue_comp_unit (per_cu, dwarf2_per_objfile, language_minimal); load_cu (per_cu, dwarf2_per_objfile, skip_partial); /* If we just loaded a CU from a DWO, and we're working with an index @@ -7541,7 +7543,7 @@ process_psymtab_comp_unit (dwarf2_per_cu_data *this_cu, read in the compilation unit (see load_partial_dies). This problem could be avoided, but the benefit is unclear. */ if (this_cu->cu != NULL) - free_one_cached_comp_unit (this_cu); + free_one_cached_comp_unit (this_cu, per_objfile); cutu_reader reader (this_cu, per_objfile, NULL, 0, false); @@ -8899,11 +8901,12 @@ dwarf2_psymtab::read_symtab (struct objfile *objfile) /* Add PER_CU to the queue. */ static void -queue_comp_unit (struct dwarf2_per_cu_data *per_cu, +queue_comp_unit (dwarf2_per_cu_data *per_cu, + dwarf2_per_objfile *per_objfile, enum language pretend_language) { per_cu->queued = 1; - per_cu->per_bfd->queue.emplace (per_cu, pretend_language); + per_cu->per_bfd->queue.emplace (per_cu, per_objfile, pretend_language); } /* If PER_CU is not yet queued, add it to the queue. @@ -8917,7 +8920,8 @@ queue_comp_unit (struct dwarf2_per_cu_data *per_cu, static int maybe_queue_comp_unit (struct dwarf2_cu *dependent_cu, - struct dwarf2_per_cu_data *per_cu, + dwarf2_per_cu_data *per_cu, + dwarf2_per_objfile *per_objfile, enum language pretend_language) { /* We may arrive here during partial symbol reading, if we need full @@ -8948,7 +8952,7 @@ maybe_queue_comp_unit (struct dwarf2_cu *dependent_cu, } /* Add it to the queue. */ - queue_comp_unit (per_cu, pretend_language); + queue_comp_unit (per_cu, per_objfile, pretend_language); return 1; } @@ -9909,7 +9913,7 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu) return; /* If necessary, add it to the queue and load its DIEs. */ - if (maybe_queue_comp_unit (cu, per_cu, cu->language)) + if (maybe_queue_comp_unit (cu, per_cu, per_objfile, cu->language)) load_full_comp_unit (per_cu, per_objfile, false, cu->language); cu->per_cu->imported_symtabs_push (per_cu); @@ -12823,7 +12827,7 @@ queue_and_load_dwo_tu (void **slot, void *info) /* We pass NULL for DEPENDENT_CU because we don't yet know if there's a real dependency of PER_CU on SIG_TYPE. That is detected later while processing PER_CU. */ - if (maybe_queue_comp_unit (NULL, sig_cu, cu->language)) + if (maybe_queue_comp_unit (NULL, sig_cu, cu->per_objfile, cu->language)) load_full_type_unit (sig_cu, cu->per_objfile); cu->per_cu->imported_symtabs_push (sig_cu); } @@ -22208,7 +22212,7 @@ follow_die_offset (sect_offset sect_off, int offset_in_dwz, dwarf2_per_objfile); /* If necessary, add it to the queue and load its DIEs. */ - if (maybe_queue_comp_unit (cu, per_cu, cu->language)) + if (maybe_queue_comp_unit (cu, per_cu, dwarf2_per_objfile, cu->language)) load_full_comp_unit (per_cu, dwarf2_per_objfile, false, cu->language); target_cu = per_cu->cu; @@ -22571,6 +22575,8 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type, struct die_info temp_die; struct dwarf2_cu *sig_cu, *cu = *ref_cu; struct die_info *die; + dwarf2_per_objfile *dwarf2_per_objfile = (*ref_cu)->per_objfile; + /* While it might be nice to assert sig_type->type == NULL here, we can get here for DW_AT_imported_declaration where we need @@ -22578,8 +22584,9 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type, /* If necessary, add it to the queue and load its DIEs. */ - if (maybe_queue_comp_unit (*ref_cu, &sig_type->per_cu, language_minimal)) - read_signatured_type (sig_type, (*ref_cu)->per_objfile); + if (maybe_queue_comp_unit (*ref_cu, &sig_type->per_cu, dwarf2_per_objfile, + language_minimal)) + read_signatured_type (sig_type, dwarf2_per_objfile); sig_cu = sig_type->per_cu.cu; gdb_assert (sig_cu != NULL); @@ -22589,8 +22596,6 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type, to_underlying (temp_die.sect_off)); if (die) { - struct dwarf2_per_objfile *dwarf2_per_objfile = (*ref_cu)->per_objfile; - /* For .gdb_index version 7 keep track of included TUs. http://sourceware.org/bugzilla/show_bug.cgi?id=15021. */ if (dwarf2_per_objfile->per_bfd->index_table != NULL @@ -23568,11 +23573,10 @@ age_cached_comp_units (struct dwarf2_per_objfile *dwarf2_per_objfile) /* Remove a single compilation unit from the cache. */ static void -free_one_cached_comp_unit (struct dwarf2_per_cu_data *target_per_cu) +free_one_cached_comp_unit (dwarf2_per_cu_data *target_per_cu, + dwarf2_per_objfile *dwarf2_per_objfile) { struct dwarf2_per_cu_data *per_cu, **last_chain; - struct dwarf2_per_objfile *dwarf2_per_objfile - = target_per_cu->dwarf2_per_objfile; per_cu = dwarf2_per_objfile->per_bfd->read_in_chain; last_chain = &dwarf2_per_objfile->per_bfd->read_in_chain; diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index dda5ed71c4d..3dada4852d7 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -52,8 +52,10 @@ struct signatured_type; for. */ struct dwarf2_queue_item { - dwarf2_queue_item (dwarf2_per_cu_data *cu, enum language lang) + dwarf2_queue_item (dwarf2_per_cu_data *cu, dwarf2_per_objfile *per_objfile, + enum language lang) : per_cu (cu), + per_objfile (per_objfile), pretend_language (lang) { } @@ -62,7 +64,8 @@ struct dwarf2_queue_item DISABLE_COPY_AND_ASSIGN (dwarf2_queue_item); - struct dwarf2_per_cu_data *per_cu; + dwarf2_per_cu_data *per_cu; + dwarf2_per_objfile *per_objfile; enum language pretend_language; }; -- 2.26.2