From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from progateway7-pub.mail.pro1.eigbox.com (gproxy5-pub.mail.unifiedlayer.com [67.222.38.55]) by sourceware.org (Postfix) with ESMTPS id 710D238582B0 for ; Mon, 13 Feb 2023 03:53:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 710D238582B0 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from cmgw12.mail.unifiedlayer.com (unknown [10.0.90.127]) by progateway7.mail.pro1.eigbox.com (Postfix) with ESMTP id DFB8F1004740B for ; Mon, 13 Feb 2023 03:53:40 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id RPuOphKCdFh3zRPuOp7Nxq; Mon, 13 Feb 2023 03:53:40 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=QpabYX+d c=1 sm=1 tr=0 ts=63e9b444 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10:nop_charset_1 a=m04uMKEZRckA:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=7d_E57ReAAAA:8 a=wkmQqQHD6Dkg1njgS7oA:9 a=QEXdDO2ut3YA:10:nop_charset_2 a=jhqOcbufqs7Y1TYCrUUU:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=prJbeGCPShdrcGbnw9MMurL8QpcPE8UTnBMvy+By0HI=; b=xPKSj1+27+8yam7aw3N1njXS1B WE9agaBqxIOoIIRDt1S+d9w6eqGy4S6ymz2NH4Q20GJZbVFxGK7Jh/RTkt4W02vgnqI+wpsSAwuTa akx5gk4i3wxHc3+d4hv+I8WIP; Received: from 75-166-130-93.hlrn.qwest.net ([75.166.130.93]:37668 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pRPJS-001AGJ-Nf; Sun, 12 Feb 2023 20:15:30 -0700 From: Tom Tromey Date: Sun, 12 Feb 2023 20:15:47 -0700 Subject: [PATCH v3 31/50] Turn value_bits_synthetic_pointer into a method MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230209-submit-value-fixups-2023-v3-31-45e91a20c742@tromey.com> References: <20230209-submit-value-fixups-2023-v3-0-45e91a20c742@tromey.com> In-Reply-To: <20230209-submit-value-fixups-2023-v3-0-45e91a20c742@tromey.com> To: gdb-patches@sourceware.org Cc: Simon Marchi X-Mailer: b4 0.12.0 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: 75.166.130.93 X-Source-L: No X-Exim-ID: 1pRPJS-001AGJ-Nf X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-130-93.hlrn.qwest.net ([192.168.0.21]) [75.166.130.93]:37668 X-Source-Auth: tom+tromey.com X-Email-Count: 79 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3027.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This changes value_bits_synthetic_pointer to be a method of value. Approved-By: Simon Marchi --- gdb/cp-valprint.c | 6 +++--- gdb/dwarf2/expr.c | 4 ++-- gdb/opencl-lang.c | 5 ++--- gdb/p-valprint.c | 6 +++--- gdb/valops.c | 4 ++-- gdb/valprint.c | 9 ++++----- gdb/value.c | 12 +++++------- gdb/value.h | 11 +++++------ 8 files changed, 26 insertions(+), 31 deletions(-) diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index dd396825798..5f18d372aa3 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -270,9 +270,9 @@ cp_print_value_fields (struct value *val, struct ui_file *stream, fputs_styled ("", metadata_style.style (), stream); } - else if (value_bits_synthetic_pointer - (val, type->field (i).loc_bitpos (), - TYPE_FIELD_BITSIZE (type, i))) + else if (val->bits_synthetic_pointer + (type->field (i).loc_bitpos (), + TYPE_FIELD_BITSIZE (type, i))) { fputs_styled (_(""), metadata_style.style (), stream); diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index e08dca01a67..ef93b89aaa9 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -576,8 +576,8 @@ coerce_pieced_ref (const value *value) { struct type *type = check_typedef (value->type ()); - if (value_bits_synthetic_pointer (value, value->embedded_offset (), - TARGET_CHAR_BIT * type->length ())) + if (value->bits_synthetic_pointer (value->embedded_offset (), + TARGET_CHAR_BIT * type->length ())) { const piece_closure *closure = (piece_closure *) value->computed_closure (); diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index 8bc727cdfdf..e4a88a23d49 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -215,9 +215,8 @@ lval_func_check_synthetic_pointer (const struct value *v, int comp_offset = (i == start) ? startrest : 0; int comp_length = (i == end) ? endrest : elsize; - if (!value_bits_synthetic_pointer (c->val, - c->indices[i] * elsize + comp_offset, - comp_length)) + if (!c->val->bits_synthetic_pointer (c->indices[i] * elsize + comp_offset, + comp_length)) return 0; } diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index c6b9b5571dd..4b84ec1c43f 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -609,9 +609,9 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream, fputs_styled ("", metadata_style.style (), stream); } - else if (value_bits_synthetic_pointer - (val, type->field (i).loc_bitpos (), - TYPE_FIELD_BITSIZE (type, i))) + else if (val->bits_synthetic_pointer + (type->field (i).loc_bitpos (), + TYPE_FIELD_BITSIZE (type, i))) { fputs_styled (_(""), metadata_style.style (), stream); diff --git a/gdb/valops.c b/gdb/valops.c index 6896478c0f8..fc9c6dcfe64 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1556,8 +1556,8 @@ value_addr (struct value *arg1) if (TYPE_IS_REFERENCE (type)) { - if (value_bits_synthetic_pointer (arg1, arg1->embedded_offset (), - TARGET_CHAR_BIT * type->length ())) + if (arg1->bits_synthetic_pointer (arg1->embedded_offset (), + TARGET_CHAR_BIT * type->length ())) arg1 = coerce_ref (arg1); else { diff --git a/gdb/valprint.c b/gdb/valprint.c index 2fa18b8f8e8..08e8826e5b9 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -381,8 +381,8 @@ valprint_check_validity (struct ui_file *stream, return 0; } - if (value_bits_synthetic_pointer (val, TARGET_CHAR_BIT * embedded_offset, - TARGET_CHAR_BIT * type->length ())) + if (val->bits_synthetic_pointer (TARGET_CHAR_BIT * embedded_offset, + TARGET_CHAR_BIT * type->length ())) { const int is_ref = type->code () == TYPE_CODE_REF; int ref_is_addressable = 0; @@ -568,9 +568,8 @@ generic_val_print_ref (struct type *type, struct type *elttype = check_typedef (type->target_type ()); struct value *deref_val = NULL; const int value_is_synthetic - = value_bits_synthetic_pointer (original_value, - TARGET_CHAR_BIT * embedded_offset, - TARGET_CHAR_BIT * type->length ()); + = original_value->bits_synthetic_pointer (TARGET_CHAR_BIT * embedded_offset, + TARGET_CHAR_BIT * type->length ()); const int must_coerce_ref = ((options->addressprint && value_is_synthetic) || options->deref_ref); const int type_is_defined = elttype->code () != TYPE_CODE_UNDEF; diff --git a/gdb/value.c b/gdb/value.c index 6198fb84d22..75f8dc49b0a 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -1365,15 +1365,13 @@ mark_value_bits_optimized_out (struct value *value, } int -value_bits_synthetic_pointer (const struct value *value, - LONGEST offset, LONGEST length) +value::bits_synthetic_pointer (LONGEST offset, LONGEST length) const { - if (value->m_lval != lval_computed - || !value->m_location.computed.funcs->check_synthetic_pointer) + if (m_lval != lval_computed + || !m_location.computed.funcs->check_synthetic_pointer) return 0; - return value->m_location.computed.funcs->check_synthetic_pointer (value, - offset, - length); + return m_location.computed.funcs->check_synthetic_pointer (this, offset, + length); } const struct lval_funcs * diff --git a/gdb/value.h b/gdb/value.h index b025d678c6d..57385842919 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -455,6 +455,11 @@ struct value values. */ bool contents_eq (const struct value *val2) const; + /* Given a value, determine whether the bits starting at OFFSET and + extending for LENGTH bits are a synthetic pointer. */ + + int bits_synthetic_pointer (LONGEST offset, LONGEST length) const; + /* Type of value; either not an lval, or one of the various different possible kinds of lval. */ @@ -862,12 +867,6 @@ extern struct value *coerce_ref (struct value *value); extern struct value *coerce_array (struct value *value); -/* Given a value, determine whether the bits starting at OFFSET and - extending for LENGTH bits are a synthetic pointer. */ - -extern int value_bits_synthetic_pointer (const struct value *value, - LONGEST offset, LONGEST length); - /* Given a value, determine whether the contents bytes starting at OFFSET and extending for LENGTH bytes are available. This returns nonzero if all bytes in the given range are available, zero if any -- 2.39.1