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 7EC5C383F850 for ; Tue, 12 May 2020 21:17:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7EC5C383F850 X-ASG-Debug-ID: 1589318259-0c856e314b8938a0001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id QkVBAizMFcshIlud (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 12 May 2020 17:17:39 -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 A7B60441B21; Tue, 12 May 2020 17:17:39 -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 Subject: [PATCH v2 30/42] Add dwarf2_per_objfile parameter to get_die_type_at_offset Date: Tue, 12 May 2020 17:17:00 -0400 X-ASG-Orig-Subj: [PATCH v2 30/42] Add dwarf2_per_objfile parameter to get_die_type_at_offset Message-Id: <20200512211712.6543-31-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: 1589318259 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: 6556 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.0 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:17:42 -0000 From: Simon Marchi This allows removing some dwarf2_per_cu_data::dwarf2_per_objfile references. gdb/ChangeLog: * dwarf2/read.h (dwarf2_get_die_type): Add dwarf2_per_objfile parameter. * dwarf2/read.c (get_die_type_at_offset): Likewise. (read_namespace_alias): Update. (lookup_die_type): Update. (dwarf2_get_die_type): Add dwarf2_per_objfile parameter. * dwarf2/loc.c (class dwarf_evaluate_loc_desc) : Update. (disassemble_dwarf_expression): Update. --- gdb/dwarf2/loc.c | 10 +++++----- gdb/dwarf2/read.c | 21 ++++++++++++--------- gdb/dwarf2/read.h | 3 ++- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index a4b7edf7bff..cd304552575 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -673,7 +673,7 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context struct type *get_base_type (cu_offset die_offset, int size) override { - struct type *result = dwarf2_get_die_type (die_offset, per_cu); + struct type *result = dwarf2_get_die_type (die_offset, per_cu, per_objfile); if (result == NULL) error (_("Could not find type for DW_OP_const_type")); if (size != 0 && TYPE_LENGTH (result) != size) @@ -4162,7 +4162,7 @@ disassemble_dwarf_expression (struct ui_file *stream, data = safe_read_uleb128 (data, end, &ul); cu_offset offset = (cu_offset) ul; - type = dwarf2_get_die_type (offset, per_cu); + type = dwarf2_get_die_type (offset, per_cu, per_objfile); fprintf_filtered (stream, "<"); type_print (type, "", stream, -1); fprintf_filtered (stream, " [0x%s]> %d", @@ -4178,7 +4178,7 @@ disassemble_dwarf_expression (struct ui_file *stream, data = safe_read_uleb128 (data, end, &ul); cu_offset type_die = (cu_offset) ul; - type = dwarf2_get_die_type (type_die, per_cu); + type = dwarf2_get_die_type (type_die, per_cu, per_objfile); fprintf_filtered (stream, "<"); type_print (type, "", stream, -1); fprintf_filtered (stream, " [0x%s]>", @@ -4202,7 +4202,7 @@ disassemble_dwarf_expression (struct ui_file *stream, data = safe_read_uleb128 (data, end, &ul); cu_offset type_die = (cu_offset) ul; - type = dwarf2_get_die_type (type_die, per_cu); + type = dwarf2_get_die_type (type_die, per_cu, per_objfile); fprintf_filtered (stream, "<"); type_print (type, "", stream, -1); fprintf_filtered (stream, " [0x%s]> [$%s]", @@ -4225,7 +4225,7 @@ disassemble_dwarf_expression (struct ui_file *stream, { struct type *type; - type = dwarf2_get_die_type (type_die, per_cu); + type = dwarf2_get_die_type (type_die, per_cu, per_objfile); fprintf_filtered (stream, "<"); type_print (type, "", stream, -1); fprintf_filtered (stream, " [0x%s]>", diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index e8ba115fe4f..3e5f91583cb 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -1599,7 +1599,8 @@ static void dwarf2_mark (struct dwarf2_cu *); static void dwarf2_clear_marks (struct dwarf2_per_cu_data *); static struct type *get_die_type_at_offset (sect_offset, - struct dwarf2_per_cu_data *); + dwarf2_per_cu_data *per_cu, + dwarf2_per_objfile *per_objfile); static struct type *get_die_type (struct die_info *die, struct dwarf2_cu *cu); @@ -10556,7 +10557,7 @@ read_namespace_alias (struct die_info *die, struct dwarf2_cu *cu) struct type *type; sect_offset sect_off = attr->get_ref_die_offset (); - type = get_die_type_at_offset (sect_off, cu->per_cu); + type = get_die_type_at_offset (sect_off, cu->per_cu, cu->per_objfile); if (type != NULL && TYPE_CODE (type) == TYPE_CODE_NAMESPACE) { /* This declaration is a global namespace alias. Add @@ -21351,13 +21352,14 @@ lookup_die_type (struct die_info *die, const struct attribute *attr, per_cu = dwarf2_find_containing_comp_unit (sect_off, 1, dwarf2_per_objfile); - this_type = get_die_type_at_offset (sect_off, per_cu); + this_type = get_die_type_at_offset (sect_off, per_cu, dwarf2_per_objfile); } else if (attr->form_is_ref ()) { sect_offset sect_off = attr->get_ref_die_offset (); - this_type = get_die_type_at_offset (sect_off, cu->per_cu); + this_type = get_die_type_at_offset (sect_off, cu->per_cu, + dwarf2_per_objfile); } else if (attr->form == DW_FORM_ref_sig8) { @@ -22557,10 +22559,11 @@ dwarf2_fetch_die_type_sect_off (sect_offset sect_off, struct type * dwarf2_get_die_type (cu_offset die_offset, - struct dwarf2_per_cu_data *per_cu) + dwarf2_per_cu_data *per_cu, + dwarf2_per_objfile *per_objfile) { sect_offset die_offset_sect = per_cu->sect_off + to_underlying (die_offset); - return get_die_type_at_offset (die_offset_sect, per_cu); + return get_die_type_at_offset (die_offset_sect, per_cu, per_objfile); } /* Follow type unit SIG_TYPE referenced by SRC_DIE. @@ -23750,10 +23753,10 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) static struct type * get_die_type_at_offset (sect_offset sect_off, - struct dwarf2_per_cu_data *per_cu) + dwarf2_per_cu_data *per_cu, + dwarf2_per_objfile *dwarf2_per_objfile) { struct dwarf2_per_cu_offset_and_type *slot, ofs; - struct dwarf2_per_objfile *dwarf2_per_objfile = per_cu->dwarf2_per_objfile; if (dwarf2_per_objfile->die_type_hash == NULL) return NULL; @@ -23774,7 +23777,7 @@ get_die_type_at_offset (sect_offset sect_off, static struct type * get_die_type (struct die_info *die, struct dwarf2_cu *cu) { - return get_die_type_at_offset (die->sect_off, cu->per_cu); + return get_die_type_at_offset (die->sect_off, cu->per_cu, cu->per_objfile); } /* Add a dependence relationship from CU to REF_PER_CU. */ diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index 3dada4852d7..cc1fd914b6f 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -569,7 +569,8 @@ extern dwz_file *dwarf2_get_dwz_file (dwarf2_per_bfd *per_bfd); PER_CU. */ struct type *dwarf2_get_die_type (cu_offset die_offset, - struct dwarf2_per_cu_data *per_cu); + dwarf2_per_cu_data *per_cu, + dwarf2_per_objfile *per_objfile); /* Given an index in .debug_addr, fetch the value. NOTE: This can be called during dwarf expression evaluation, -- 2.26.2