From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from outbound-ss-820.bluehost.com (outbound-ss-820.bluehost.com [69.89.24.241]) by sourceware.org (Postfix) with ESMTPS id 27B4A3858D33 for ; Tue, 14 Feb 2023 20:23:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 27B4A3858D33 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 cmgw10.mail.unifiedlayer.com (unknown [10.0.90.125]) by progateway2.mail.pro1.eigbox.com (Postfix) with ESMTP id 8C3B110048525 for ; Tue, 14 Feb 2023 20:23:40 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id S1q0pOO7NA1zNS1q0pAuVi; Tue, 14 Feb 2023 20:23:40 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=CqN6zl0D c=1 sm=1 tr=0 ts=63ebedcc 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=z-40141oyrumv8niXycA: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=TmoRWcfB8h6EAt+dUMENhwFliD+0nOQdWi5sDGdP3IE=; b=CL9hjaNdhHvmpvkUzz+LH76abc z1m3/1HErWQay8FDfFESzm4YloxkiUEQtd/oOrr9pol6V7qqWRMmwDRA++QXV2twiUU2FVA/4gOQ5 7H2gD2fcH4anhKLtQsR2vd/63; 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-Cp for gdb-patches@sourceware.org; Tue, 14 Feb 2023 13:23:40 -0700 From: Tom Tromey Date: Tue, 14 Feb 2023 13:23:31 -0700 Subject: [PATCH 1/6] Change value::m_modifiable to bool MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230214-submit-more-value-stuff-v1-1-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-Cp 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: 2 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::m_modifiable to be a bool and updates the various uses. --- gdb/breakpoint.c | 3 +-- gdb/ppc-linux-nat.c | 2 +- gdb/value.c | 6 +++--- gdb/value.h | 8 ++++---- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 3b9aebc5605..b1922fc1e98 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -10450,8 +10450,7 @@ can_use_hardware_watchpoint (const std::vector &vals) } } } - else if (v->lval () != not_lval - && v->deprecated_modifiable () == 0) + else if (v->lval () != not_lval && !v->deprecated_modifiable ()) return 0; /* These are values from the history (e.g., $1). */ else if (v->lval () == lval_register) return 0; /* Cannot watch a register with a HW watchpoint. */ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index 32c0177228a..494e9bf6119 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -2455,7 +2455,7 @@ ppc_linux_nat_target::num_memory_accesses (const std::vector struct value *v = iter.get (); /* Constants and values from the history are fine. */ - if (v->lval () == not_lval || v->deprecated_modifiable () == 0) + if (v->lval () == not_lval || !v->deprecated_modifiable ()) continue; else if (v->lval () == lval_memory) { diff --git a/gdb/value.c b/gdb/value.c index 7873aeb9558..b027b63ee48 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -1676,7 +1676,7 @@ value::record_latest () /* We preserve VALUE_LVAL so that the user can find out where it was fetched from. This is a bit dubious, because then *&$1 does not just return $1 but the current contents of that location. c'est la vie... */ - set_modifiable (0); + set_modifiable (false); value_history.push_back (release_value (this)); @@ -2169,7 +2169,7 @@ set_internalvar (struct internalvar *var, struct value *val) default: new_kind = INTERNALVAR_VALUE; struct value *copy = val->copy (); - copy->set_modifiable (1); + copy->set_modifiable (true); /* Force the value to be fetched from the target now, to avoid problems later when this internalvar is referenced and the target is gone or @@ -2492,7 +2492,7 @@ value::from_xmethod (xmethod_worker_up &&worker) v = value::allocate (builtin_type (target_gdbarch ())->xmethod); v->m_lval = lval_xcallable; v->m_location.xm_worker = worker.release (); - v->m_modifiable = 0; + v->m_modifiable = false; return v; } diff --git a/gdb/value.h b/gdb/value.h index 8b45f7fdee8..92247185cd0 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -132,7 +132,7 @@ struct value /* Values can only be created via "static constructors". */ explicit value (struct type *type_) - : m_modifiable (1), + : m_modifiable (true), m_lazy (1), m_initialized (1), m_stack (0), @@ -228,11 +228,11 @@ struct value /* The comment from "struct value" reads: ``Is it modifiable? Only relevant if lval != not_lval.''. Shouldn't the value instead be not_lval and be done with it? */ - int deprecated_modifiable () const + bool deprecated_modifiable () const { return m_modifiable; } /* Set or clear the modifiable flag. */ - void set_modifiable (int val) + void set_modifiable (bool val) { m_modifiable = val; } LONGEST pointed_to_offset () const @@ -619,7 +619,7 @@ struct value enum lval_type m_lval = not_lval; /* Is it modifiable? Only relevant if lval != not_lval. */ - unsigned int m_modifiable : 1; + bool m_modifiable : 1; /* If zero, contents of this value are in the contents field. If nonzero, contents are in inferior. If the lval field is lval_memory, -- 2.39.1