From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from alt-proxy28.mail.unifiedlayer.com (alt-proxy28.mail.unifiedlayer.com [74.220.216.123]) by sourceware.org (Postfix) with ESMTPS id 968813858C53 for ; Tue, 14 Feb 2023 20:23:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 968813858C53 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 progateway1.mail.pro1.eigbox.com (Postfix) with ESMTP id 12C1310038A07 for ; Tue, 14 Feb 2023 20:23:41 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id S1q1p6ozDFh3zS1q1pWfIA; Tue, 14 Feb 2023 20:23:41 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=QpabYX+d c=1 sm=1 tr=0 ts=63ebedcd 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=lomSTQFzVKiumFt1d-8A:9 a=QEXdDO2ut3YA:10:nop_charset_2 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=kAeKSmRzOs6OQLY3r26DyosFMMXBGpLJjfvqtxOhcAE=; b=Z4lmn8gcLxsmhZFBxtKyncwaeg ZAImSsb7atXOAZWuA/dOHuMNqwtlp8sgL03NJF876ZS8QFmMHexjg9jt4O5SJNLEk4ub9alJTKnzu JGmFcIXF1/6JD4xFta8D2gEdf; Received: from 75-166-130-93.hlrn.qwest.net ([75.166.130.93]:49794 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 1pS1q0-002zny-TB for gdb-patches@sourceware.org; Tue, 14 Feb 2023 13:23:40 -0700 From: Tom Tromey Date: Tue, 14 Feb 2023 13:23:35 -0700 Subject: [PATCH 5/6] Have value::bits_synthetic_pointer return bool MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230214-submit-more-value-stuff-v1-5-2fb85efbaa72@tromey.com> References: <20230214-submit-more-value-stuff-v1-0-2fb85efbaa72@tromey.com> In-Reply-To: <20230214-submit-more-value-stuff-v1-0-2fb85efbaa72@tromey.com> To: gdb-patches@sourceware.org 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: 1pS1q0-002zny-TB 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]:49794 X-Source-Auth: tom+tromey.com X-Email-Count: 6 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3027.2 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 return bool and fixes up some fallout from this. --- gdb/dwarf2/expr.c | 6 +++--- gdb/opencl-lang.c | 10 +++++----- gdb/valprint.c | 2 +- gdb/value.c | 4 ++-- gdb/value.h | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index 3f040e7b2d3..b48bab0b410 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -459,7 +459,7 @@ is_optimized_out_pieced_value (value *v) /* An implementation of an lval_funcs method to see whether a value is a synthetic pointer. */ -static int +static bool check_pieced_synthetic_pointer (const value *value, LONGEST bit_offset, int bit_length) { @@ -490,10 +490,10 @@ check_pieced_synthetic_pointer (const value *value, LONGEST bit_offset, bit_length -= this_size_bits; if (p->location != DWARF_VALUE_IMPLICIT_POINTER) - return 0; + return false; } - return 1; + return true; } /* An implementation of an lval_funcs method to indirect through a diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index 3e4a9c360b2..ae1a6d4446d 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -187,10 +187,10 @@ lval_func_write (struct value *v, struct value *fromval) } } -/* Return nonzero if bits in V from OFFSET and LENGTH represent a +/* Return true if bits in V from OFFSET and LENGTH represent a synthetic pointer. */ -static int +static bool lval_func_check_synthetic_pointer (const struct value *v, LONGEST offset, int length) { @@ -208,7 +208,7 @@ lval_func_check_synthetic_pointer (const struct value *v, end++; if (end > c->n) - return 0; + return false; for (i = start; i < end; i++) { @@ -217,10 +217,10 @@ lval_func_check_synthetic_pointer (const struct value *v, if (!c->val->bits_synthetic_pointer (c->indices[i] * elsize + comp_offset, comp_length)) - return 0; + return false; } - return 1; + return true; } static void * diff --git a/gdb/valprint.c b/gdb/valprint.c index 8c067693492..357db3815b0 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -566,7 +566,7 @@ 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 + const bool value_is_synthetic = 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) diff --git a/gdb/value.c b/gdb/value.c index 6a8c12823c4..9e561e28551 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -1315,12 +1315,12 @@ value::mark_bits_optimized_out (LONGEST offset, LONGEST length) insert_into_bit_range_vector (&m_optimized_out, offset, length); } -int +bool value::bits_synthetic_pointer (LONGEST offset, LONGEST length) const { if (m_lval != lval_computed || !m_location.computed.funcs->check_synthetic_pointer) - return 0; + return false; return m_location.computed.funcs->check_synthetic_pointer (this, offset, length); } diff --git a/gdb/value.h b/gdb/value.h index 4cb6fac4104..5536e00332e 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -475,7 +475,7 @@ struct value /* 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; + bool bits_synthetic_pointer (LONGEST offset, LONGEST length) const; /* Increase this value's reference count. */ void incref () @@ -924,8 +924,8 @@ struct lval_funcs /* If non-NULL, this is used to determine whether the indicated bits of VALUE are a synthetic pointer. */ - int (*check_synthetic_pointer) (const struct value *value, - LONGEST offset, int length); + bool (*check_synthetic_pointer) (const struct value *value, + LONGEST offset, int length); /* Return a duplicate of VALUE's closure, for use in a new value. This may simply return the same closure, if VALUE's is -- 2.39.1