From patchwork Thu Feb 9 21:38:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 64559 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 95198384F011 for ; Thu, 9 Feb 2023 21:39:27 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from outbound-ss-820.bluehost.com (outbound-ss-820.bluehost.com [69.89.24.241]) by sourceware.org (Postfix) with ESMTPS id 912453858C5F for ; Thu, 9 Feb 2023 21:38:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 912453858C5F 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 progateway2.mail.pro1.eigbox.com (Postfix) with ESMTP id E29FF10047F90 for ; Thu, 9 Feb 2023 21:38:39 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id QEcppzBNYP796QEcppwoV5; Thu, 09 Feb 2023 21:38:39 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=MJClJOVl c=1 sm=1 tr=0 ts=63e567df 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=_wBDaLaCibmPkRHvG1wA: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=oIBDPpBQsNigcHEF6NUiGGWNbR9+91iYWIO2FQvZrhM=; b=XDPaW6fSWbkgO3AlDcLJft/cWB ycvdk9ul5rTMfQ2S1gl5F/EWUe03bGLsECyaK3V88yeDXHHNL2aXjiw1t7kV+OgA8BTiQ4QiHSBNP 3aO/cE1ojSLqF07lUQoITlhUq; Received: from 75-166-130-93.hlrn.qwest.net ([75.166.130.93]:52822 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 1pQEcp-001ZcE-MP for gdb-patches@sourceware.org; Thu, 09 Feb 2023 14:38:39 -0700 From: Tom Tromey Date: Thu, 09 Feb 2023 14:38:22 -0700 Subject: [PATCH 01/47] Rename all fields of struct value MIME-Version: 1.0 Message-Id: <20230209-submit-value-fixups-2023-v1-1-55dc2794dbb9@tromey.com> References: <20230209-submit-value-fixups-2023-v1-0-55dc2794dbb9@tromey.com> In-Reply-To: <20230209-submit-value-fixups-2023-v1-0-55dc2794dbb9@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: 1pQEcp-001ZcE-MP 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]:52822 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3027.3 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 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: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" This renames all the fields of struct value, in preparation for the coming changes. --- gdb/value.c | 372 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 186 insertions(+), 186 deletions(-) diff --git a/gdb/value.c b/gdb/value.c index e3f60e7e989..c998a516a0f 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -180,13 +180,13 @@ static struct cmd_list_element *functionlist; struct value { explicit value (struct type *type_) - : modifiable (1), - lazy (1), - initialized (1), - stack (0), - is_zero (false), - type (type_), - enclosing_type (type_) + : m_modifiable (1), + m_lazy (1), + m_initialized (1), + m_stack (0), + m_is_zero (false), + m_type (type_), + m_enclosing_type (type_) { } @@ -194,23 +194,23 @@ struct value { if (VALUE_LVAL (this) == lval_computed) { - const struct lval_funcs *funcs = location.computed.funcs; + const struct lval_funcs *funcs = m_location.computed.funcs; if (funcs->free_closure) funcs->free_closure (this); } else if (VALUE_LVAL (this) == lval_xcallable) - delete location.xm_worker; + delete m_location.xm_worker; } DISABLE_COPY_AND_ASSIGN (value); /* Type of value; either not an lval, or one of the various different possible kinds of lval. */ - enum lval_type lval = not_lval; + enum lval_type m_lval = not_lval; /* Is it modifiable? Only relevant if lval != not_lval. */ - unsigned int modifiable : 1; + unsigned int 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, @@ -226,18 +226,18 @@ struct value or array when the user wants to watch a single struct member or array element. If you ever change the way lazy flag is set and reset, be sure to consider this use as well! */ - unsigned int lazy : 1; + unsigned int m_lazy : 1; /* If value is a variable, is it initialized or not. */ - unsigned int initialized : 1; + unsigned int m_initialized : 1; /* If value is from the stack. If this is set, read_stack will be used instead of read_memory to enable extra caching. */ - unsigned int stack : 1; + unsigned int m_stack : 1; /* True if this is a zero value, created by 'value_zero'; false otherwise. */ - bool is_zero : 1; + bool m_is_zero : 1; /* Location of value (if lval). */ union @@ -273,35 +273,35 @@ struct value /* Closure for those functions to use. */ void *closure; } computed; - } location {}; + } m_location {}; /* Describes offset of a value within lval of a structure in target addressable memory units. Note also the member embedded_offset below. */ - LONGEST offset = 0; + LONGEST m_offset = 0; /* Only used for bitfields; number of bits contained in them. */ - LONGEST bitsize = 0; + LONGEST m_bitsize = 0; /* Only used for bitfields; position of start of field. For little-endian targets, it is the position of the LSB. For big-endian targets, it is the position of the MSB. */ - LONGEST bitpos = 0; + LONGEST m_bitpos = 0; /* The number of references to this value. When a value is created, the value chain holds a reference, so REFERENCE_COUNT is 1. If release_value is called, this value is removed from the chain but the caller of release_value now has a reference to this value. The caller must arrange for a call to value_free later. */ - int reference_count = 1; + int m_reference_count = 1; /* Only used for bitfields; the containing value. This allows a single read from the target when displaying multiple bitfields. */ - value_ref_ptr parent; + value_ref_ptr m_parent; /* Type of the value. */ - struct type *type; + struct type *m_type; /* If a value represents a C++ object, then the `type' field gives the object's compile-time type. If the object actually belongs @@ -343,15 +343,15 @@ struct value If we're not doing anything fancy, `enclosing_type' is equal to `type', and `embedded_offset' is zero, so everything works normally. */ - struct type *enclosing_type; - LONGEST embedded_offset = 0; - LONGEST pointed_to_offset = 0; + struct type *m_enclosing_type; + LONGEST m_embedded_offset = 0; + LONGEST m_pointed_to_offset = 0; /* Actual contents of the value. Target byte-order. May be nullptr if the value is lazy or is entirely optimized out. Guaranteed to be non-nullptr otherwise. */ - gdb::unique_xmalloc_ptr contents; + gdb::unique_xmalloc_ptr m_contents; /* Unavailable ranges in CONTENTS. We mark unavailable ranges, rather than available, since the common and default case is for a @@ -359,7 +359,7 @@ struct value The unavailable ranges are tracked in bits. Note that a contents bit that has been optimized out doesn't really exist in the program, so it can't be marked unavailable either. */ - std::vector unavailable; + std::vector m_unavailable; /* Likewise, but for optimized out contents (a chunk of the value of a variable that does not actually exist in the program). If LVAL @@ -368,7 +368,7 @@ struct value saved registers and optimized-out program variables values are treated pretty much the same, except not-saved registers have a different string representation and related error strings. */ - std::vector optimized_out; + std::vector m_optimized_out; }; /* See value.h. */ @@ -382,9 +382,9 @@ get_value_arch (const struct value *value) int value_bits_available (const struct value *value, LONGEST offset, LONGEST length) { - gdb_assert (!value->lazy); + gdb_assert (!value->m_lazy); - return !ranges_contain (value->unavailable, offset, length); + return !ranges_contain (value->m_unavailable, offset, length); } int @@ -399,9 +399,9 @@ value_bytes_available (const struct value *value, int value_bits_any_optimized_out (const struct value *value, int bit_offset, int bit_length) { - gdb_assert (!value->lazy); + gdb_assert (!value->m_lazy); - return ranges_contain (value->optimized_out, bit_offset, bit_length); + return ranges_contain (value->m_optimized_out, bit_offset, bit_length); } int @@ -409,10 +409,10 @@ value_entirely_available (struct value *value) { /* We can only tell whether the whole value is available when we try to read it. */ - if (value->lazy) + if (value->m_lazy) value_fetch_lazy (value); - if (value->unavailable.empty ()) + if (value->m_unavailable.empty ()) return 1; return 0; } @@ -427,7 +427,7 @@ value_entirely_covered_by_range_vector (struct value *value, { /* We can only tell whether the whole value is optimized out / unavailable when we try to read it. */ - if (value->lazy) + if (value->m_lazy) value_fetch_lazy (value); if (ranges.size () == 1) @@ -446,13 +446,13 @@ value_entirely_covered_by_range_vector (struct value *value, int value_entirely_unavailable (struct value *value) { - return value_entirely_covered_by_range_vector (value, value->unavailable); + return value_entirely_covered_by_range_vector (value, value->m_unavailable); } int value_entirely_optimized_out (struct value *value) { - return value_entirely_covered_by_range_vector (value, value->optimized_out); + return value_entirely_covered_by_range_vector (value, value->m_optimized_out); } /* Insert into the vector pointed to by VECTORP the bit range starting of @@ -628,7 +628,7 @@ void mark_value_bits_unavailable (struct value *value, LONGEST offset, LONGEST length) { - insert_into_bit_range_vector (&value->unavailable, offset, length); + insert_into_bit_range_vector (&value->m_unavailable, offset, length); } void @@ -854,20 +854,20 @@ value_contents_bits_eq (const struct value *val1, int offset1, struct ranges_and_idx rp1[2], rp2[2]; /* See function description in value.h. */ - gdb_assert (!val1->lazy && !val2->lazy); + gdb_assert (!val1->m_lazy && !val2->m_lazy); /* We shouldn't be trying to compare past the end of the values. */ gdb_assert (offset1 + length - <= val1->enclosing_type->length () * TARGET_CHAR_BIT); + <= val1->m_enclosing_type->length () * TARGET_CHAR_BIT); gdb_assert (offset2 + length - <= val2->enclosing_type->length () * TARGET_CHAR_BIT); + <= val2->m_enclosing_type->length () * TARGET_CHAR_BIT); memset (&rp1, 0, sizeof (rp1)); memset (&rp2, 0, sizeof (rp2)); - rp1[0].ranges = &val1->unavailable; - rp2[0].ranges = &val2->unavailable; - rp1[1].ranges = &val1->optimized_out; - rp2[1].ranges = &val2->optimized_out; + rp1[0].ranges = &val1->m_unavailable; + rp2[0].ranges = &val2->m_unavailable; + rp1[1].ranges = &val1->m_optimized_out; + rp2[1].ranges = &val2->m_optimized_out; while (length > 0) { @@ -894,8 +894,8 @@ value_contents_bits_eq (const struct value *val1, int offset1, } /* Compare the available/valid contents. */ - if (memcmp_with_bit_offsets (val1->contents.get (), offset1, - val2->contents.get (), offset2, l) != 0) + if (memcmp_with_bit_offsets (val1->m_contents.get (), offset1, + val2->m_contents.get (), offset2, l) != 0) return false; length -= h; @@ -1039,11 +1039,11 @@ check_type_length_before_alloc (const struct type *type) static void allocate_value_contents (struct value *val) { - if (!val->contents) + if (!val->m_contents) { - check_type_length_before_alloc (val->enclosing_type); - val->contents.reset - ((gdb_byte *) xzalloc (val->enclosing_type->length ())); + check_type_length_before_alloc (val->m_enclosing_type); + val->m_contents.reset + ((gdb_byte *) xzalloc (val->m_enclosing_type->length ())); } } @@ -1055,7 +1055,7 @@ allocate_value (struct type *type) struct value *val = allocate_value_lazy (type); allocate_value_contents (val); - val->lazy = 0; + val->m_lazy = 0; return val; } @@ -1085,8 +1085,8 @@ allocate_computed_value (struct type *type, struct value *v = allocate_value_lazy (type); VALUE_LVAL (v) = lval_computed; - v->location.computed.funcs = funcs; - v->location.computed.closure = closure; + v->m_location.computed.funcs = funcs; + v->m_location.computed.closure = closure; return v; } @@ -1108,51 +1108,51 @@ allocate_optimized_out_value (struct type *type) struct type * value_type (const struct value *value) { - return value->type; + return value->m_type; } void deprecated_set_value_type (struct value *value, struct type *type) { - value->type = type; + value->m_type = type; } LONGEST value_offset (const struct value *value) { - return value->offset; + return value->m_offset; } void set_value_offset (struct value *value, LONGEST offset) { - value->offset = offset; + value->m_offset = offset; } LONGEST value_bitpos (const struct value *value) { - return value->bitpos; + return value->m_bitpos; } void set_value_bitpos (struct value *value, LONGEST bit) { - value->bitpos = bit; + value->m_bitpos = bit; } LONGEST value_bitsize (const struct value *value) { - return value->bitsize; + return value->m_bitsize; } void set_value_bitsize (struct value *value, LONGEST bit) { - value->bitsize = bit; + value->m_bitsize = bit; } struct value * value_parent (const struct value *value) { - return value->parent.get (); + return value->m_parent.get (); } /* See value.h. */ @@ -1160,7 +1160,7 @@ value_parent (const struct value *value) void set_value_parent (struct value *value, struct value *parent) { - value->parent = value_ref_ptr::new_reference (parent); + value->m_parent = value_ref_ptr::new_reference (parent); } gdb::array_view @@ -1173,7 +1173,7 @@ value_contents_raw (struct value *value) ULONGEST length = value_type (value)->length (); return gdb::make_array_view - (value->contents.get () + value->embedded_offset * unit_size, length); + (value->m_contents.get () + value->m_embedded_offset * unit_size, length); } gdb::array_view @@ -1182,13 +1182,13 @@ value_contents_all_raw (struct value *value) allocate_value_contents (value); ULONGEST length = value_enclosing_type (value)->length (); - return gdb::make_array_view (value->contents.get (), length); + return gdb::make_array_view (value->m_contents.get (), length); } struct type * value_enclosing_type (const struct value *value) { - return value->enclosing_type; + return value->m_enclosing_type; } /* Look at value.h for description. */ @@ -1244,9 +1244,9 @@ error_value_optimized_out (void) static void require_not_optimized_out (const struct value *value) { - if (!value->optimized_out.empty ()) + if (!value->m_optimized_out.empty ()) { - if (value->lval == lval_register) + if (value->m_lval == lval_register) throw_error (OPTIMIZED_OUT_ERROR, _("register has not been saved in frame")); else @@ -1257,27 +1257,27 @@ require_not_optimized_out (const struct value *value) static void require_available (const struct value *value) { - if (!value->unavailable.empty ()) + if (!value->m_unavailable.empty ()) throw_error (NOT_AVAILABLE_ERROR, _("value is not available")); } gdb::array_view value_contents_for_printing (struct value *value) { - if (value->lazy) + if (value->m_lazy) value_fetch_lazy (value); ULONGEST length = value_enclosing_type (value)->length (); - return gdb::make_array_view (value->contents.get (), length); + return gdb::make_array_view (value->m_contents.get (), length); } gdb::array_view value_contents_for_printing_const (const struct value *value) { - gdb_assert (!value->lazy); + gdb_assert (!value->m_lazy); ULONGEST length = value_enclosing_type (value)->length (); - return gdb::make_array_view (value->contents.get (), length); + return gdb::make_array_view (value->m_contents.get (), length); } gdb::array_view @@ -1320,11 +1320,11 @@ value_ranges_copy_adjusted (struct value *dst, int dst_bit_offset, const struct value *src, int src_bit_offset, int bit_length) { - ranges_copy_adjusted (&dst->unavailable, dst_bit_offset, - src->unavailable, src_bit_offset, + ranges_copy_adjusted (&dst->m_unavailable, dst_bit_offset, + src->m_unavailable, src_bit_offset, bit_length); - ranges_copy_adjusted (&dst->optimized_out, dst_bit_offset, - src->optimized_out, src_bit_offset, + ranges_copy_adjusted (&dst->m_optimized_out, dst_bit_offset, + src->m_optimized_out, src_bit_offset, bit_length); } @@ -1350,7 +1350,7 @@ value_contents_copy_raw (struct value *dst, LONGEST dst_offset, soon as DST's contents were un-lazied (by a later value_contents call, say), the contents would be overwritten. A lazy SRC would mean we'd be copying garbage. */ - gdb_assert (!dst->lazy && !src->lazy); + gdb_assert (!dst->m_lazy && !src->m_lazy); /* The overwritten DST range gets unavailability ORed in, not replaced. Make sure to remember to implement replacing if it @@ -1391,7 +1391,7 @@ value_contents_copy_raw_bitwise (struct value *dst, LONGEST dst_bit_offset, soon as DST's contents were un-lazied (by a later value_contents call, say), the contents would be overwritten. A lazy SRC would mean we'd be copying garbage. */ - gdb_assert (!dst->lazy && !src->lazy); + gdb_assert (!dst->m_lazy && !src->m_lazy); /* The overwritten DST range gets unavailability ORed in, not replaced. Make sure to remember to implement replacing if it @@ -1430,7 +1430,7 @@ void value_contents_copy (struct value *dst, LONGEST dst_offset, struct value *src, LONGEST src_offset, LONGEST length) { - if (src->lazy) + if (src->m_lazy) value_fetch_lazy (src); value_contents_copy_raw (dst, dst_offset, src, src_offset, length); @@ -1439,25 +1439,25 @@ value_contents_copy (struct value *dst, LONGEST dst_offset, int value_lazy (const struct value *value) { - return value->lazy; + return value->m_lazy; } void set_value_lazy (struct value *value, int val) { - value->lazy = val; + value->m_lazy = val; } int value_stack (const struct value *value) { - return value->stack; + return value->m_stack; } void set_value_stack (struct value *value, int val) { - value->stack = val; + value->m_stack = val; } gdb::array_view @@ -1472,7 +1472,7 @@ value_contents (struct value *value) gdb::array_view value_contents_writeable (struct value *value) { - if (value->lazy) + if (value->m_lazy) value_fetch_lazy (value); return value_contents_raw (value); } @@ -1480,7 +1480,7 @@ value_contents_writeable (struct value *value) int value_optimized_out (struct value *value) { - if (value->lazy) + if (value->m_lazy) { /* See if we can compute the result without fetching the value. */ @@ -1488,7 +1488,7 @@ value_optimized_out (struct value *value) return false; else if (VALUE_LVAL (value) == lval_computed) { - const struct lval_funcs *funcs = value->location.computed.funcs; + const struct lval_funcs *funcs = value->m_location.computed.funcs; if (funcs->is_optimized_out != nullptr) return funcs->is_optimized_out (value); @@ -1516,7 +1516,7 @@ value_optimized_out (struct value *value) } } - return !value->optimized_out.empty (); + return !value->m_optimized_out.empty (); } /* Mark contents of VALUE as optimized out, starting at OFFSET bytes, and @@ -1536,17 +1536,17 @@ void mark_value_bits_optimized_out (struct value *value, LONGEST offset, LONGEST length) { - insert_into_bit_range_vector (&value->optimized_out, offset, length); + insert_into_bit_range_vector (&value->m_optimized_out, offset, length); } int value_bits_synthetic_pointer (const struct value *value, LONGEST offset, LONGEST length) { - if (value->lval != lval_computed - || !value->location.computed.funcs->check_synthetic_pointer) + if (value->m_lval != lval_computed + || !value->m_location.computed.funcs->check_synthetic_pointer) return 0; - return value->location.computed.funcs->check_synthetic_pointer (value, + return value->m_location.computed.funcs->check_synthetic_pointer (value, offset, length); } @@ -1554,25 +1554,25 @@ value_bits_synthetic_pointer (const struct value *value, LONGEST value_embedded_offset (const struct value *value) { - return value->embedded_offset; + return value->m_embedded_offset; } void set_value_embedded_offset (struct value *value, LONGEST val) { - value->embedded_offset = val; + value->m_embedded_offset = val; } LONGEST value_pointed_to_offset (const struct value *value) { - return value->pointed_to_offset; + return value->m_pointed_to_offset; } void set_value_pointed_to_offset (struct value *value, LONGEST val) { - value->pointed_to_offset = val; + value->m_pointed_to_offset = val; } const struct lval_funcs * @@ -1580,84 +1580,84 @@ value_computed_funcs (const struct value *v) { gdb_assert (value_lval_const (v) == lval_computed); - return v->location.computed.funcs; + return v->m_location.computed.funcs; } void * value_computed_closure (const struct value *v) { - gdb_assert (v->lval == lval_computed); + gdb_assert (v->m_lval == lval_computed); - return v->location.computed.closure; + return v->m_location.computed.closure; } enum lval_type * deprecated_value_lval_hack (struct value *value) { - return &value->lval; + return &value->m_lval; } enum lval_type value_lval_const (const struct value *value) { - return value->lval; + return value->m_lval; } CORE_ADDR value_address (const struct value *value) { - if (value->lval != lval_memory) + if (value->m_lval != lval_memory) return 0; - if (value->parent != NULL) - return value_address (value->parent.get ()) + value->offset; + if (value->m_parent != NULL) + return value_address (value->m_parent.get ()) + value->m_offset; if (NULL != TYPE_DATA_LOCATION (value_type (value))) { gdb_assert (PROP_CONST == TYPE_DATA_LOCATION_KIND (value_type (value))); return TYPE_DATA_LOCATION_ADDR (value_type (value)); } - return value->location.address + value->offset; + return value->m_location.address + value->m_offset; } CORE_ADDR value_raw_address (const struct value *value) { - if (value->lval != lval_memory) + if (value->m_lval != lval_memory) return 0; - return value->location.address; + return value->m_location.address; } void set_value_address (struct value *value, CORE_ADDR addr) { - gdb_assert (value->lval == lval_memory); - value->location.address = addr; + gdb_assert (value->m_lval == lval_memory); + value->m_location.address = addr; } struct internalvar ** deprecated_value_internalvar_hack (struct value *value) { - return &value->location.internalvar; + return &value->m_location.internalvar; } struct frame_id * deprecated_value_next_frame_id_hack (struct value *value) { - gdb_assert (value->lval == lval_register); - return &value->location.reg.next_frame_id; + gdb_assert (value->m_lval == lval_register); + return &value->m_location.reg.next_frame_id; } int * deprecated_value_regnum_hack (struct value *value) { - gdb_assert (value->lval == lval_register); - return &value->location.reg.regnum; + gdb_assert (value->m_lval == lval_register); + return &value->m_location.reg.regnum; } int deprecated_value_modifiable (const struct value *value) { - return value->modifiable; + return value->m_modifiable; } /* Return a mark in the value chain. All values allocated after the @@ -1676,7 +1676,7 @@ value_mark (void) void value_incref (struct value *val) { - val->reference_count++; + val->m_reference_count++; } /* Release a reference to VAL, which was acquired with value_incref. @@ -1688,9 +1688,9 @@ value_decref (struct value *val) { if (val != nullptr) { - gdb_assert (val->reference_count > 0); - val->reference_count--; - if (val->reference_count == 0) + gdb_assert (val->m_reference_count > 0); + val->m_reference_count--; + if (val->m_reference_count == 0) delete val; } } @@ -1766,38 +1766,38 @@ value_copy (const value *arg) val = allocate_value_lazy (encl_type); else val = allocate_value (encl_type); - val->type = arg->type; - VALUE_LVAL (val) = arg->lval; - val->location = arg->location; - val->offset = arg->offset; - val->bitpos = arg->bitpos; - val->bitsize = arg->bitsize; - val->lazy = arg->lazy; - val->embedded_offset = value_embedded_offset (arg); - val->pointed_to_offset = arg->pointed_to_offset; - val->modifiable = arg->modifiable; - val->stack = arg->stack; - val->is_zero = arg->is_zero; - val->initialized = arg->initialized; - val->unavailable = arg->unavailable; - val->optimized_out = arg->optimized_out; + val->m_type = arg->m_type; + VALUE_LVAL (val) = arg->m_lval; + val->m_location = arg->m_location; + val->m_offset = arg->m_offset; + val->m_bitpos = arg->m_bitpos; + val->m_bitsize = arg->m_bitsize; + val->m_lazy = arg->m_lazy; + val->m_embedded_offset = value_embedded_offset (arg); + val->m_pointed_to_offset = arg->m_pointed_to_offset; + val->m_modifiable = arg->m_modifiable; + val->m_stack = arg->m_stack; + val->m_is_zero = arg->m_is_zero; + val->m_initialized = arg->m_initialized; + val->m_unavailable = arg->m_unavailable; + val->m_optimized_out = arg->m_optimized_out; if (!value_lazy (val) && !value_entirely_optimized_out (val)) { - gdb_assert (arg->contents != nullptr); + gdb_assert (arg->m_contents != nullptr); ULONGEST length = value_enclosing_type (arg)->length (); const auto &arg_view - = gdb::make_array_view (arg->contents.get (), length); + = gdb::make_array_view (arg->m_contents.get (), length); copy (arg_view, value_contents_all_raw (val)); } - val->parent = arg->parent; + val->m_parent = arg->m_parent; if (VALUE_LVAL (val) == lval_computed) { - const struct lval_funcs *funcs = val->location.computed.funcs; + const struct lval_funcs *funcs = val->m_location.computed.funcs; if (funcs->copy_closure) - val->location.computed.closure = funcs->copy_closure (val); + val->m_location.computed.closure = funcs->copy_closure (val); } return val; } @@ -1812,13 +1812,13 @@ struct value * make_cv_value (int cnst, int voltl, struct value *v) { struct type *val_type = value_type (v); - struct type *enclosing_type = value_enclosing_type (v); + struct type *m_enclosing_type = value_enclosing_type (v); struct value *cv_val = value_copy (v); deprecated_set_value_type (cv_val, make_cv_type (cnst, voltl, val_type, NULL)); set_value_enclosing_type (cv_val, - make_cv_type (cnst, voltl, enclosing_type, NULL)); + make_cv_type (cnst, voltl, m_enclosing_type, NULL)); return cv_val; } @@ -1834,7 +1834,7 @@ value_non_lval (struct value *arg) struct value *val = allocate_value (enc_type); copy (value_contents_all (arg), value_contents_all_raw (val)); - val->type = arg->type; + val->m_type = arg->m_type; set_value_embedded_offset (val, value_embedded_offset (arg)); set_value_pointed_to_offset (val, value_pointed_to_offset (arg)); return val; @@ -1850,8 +1850,8 @@ value_force_lval (struct value *v, CORE_ADDR addr) gdb_assert (VALUE_LVAL (v) == not_lval); write_memory (addr, value_contents_raw (v).data (), value_type (v)->length ()); - v->lval = lval_memory; - v->location.address = addr; + v->m_lval = lval_memory; + v->m_location.address = addr; } void @@ -1860,20 +1860,20 @@ set_value_component_location (struct value *component, { struct type *type; - gdb_assert (whole->lval != lval_xcallable); + gdb_assert (whole->m_lval != lval_xcallable); - if (whole->lval == lval_internalvar) + if (whole->m_lval == lval_internalvar) VALUE_LVAL (component) = lval_internalvar_component; else - VALUE_LVAL (component) = whole->lval; + VALUE_LVAL (component) = whole->m_lval; - component->location = whole->location; - if (whole->lval == lval_computed) + component->m_location = whole->m_location; + if (whole->m_lval == lval_computed) { - const struct lval_funcs *funcs = whole->location.computed.funcs; + const struct lval_funcs *funcs = whole->m_location.computed.funcs; if (funcs->copy_closure) - component->location.computed.closure = funcs->copy_closure (whole); + component->m_location.computed.closure = funcs->copy_closure (whole); } /* If the WHOLE value has a dynamically resolved location property then @@ -1934,7 +1934,7 @@ record_latest_value (struct value *val) /* 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... */ - val->modifiable = 0; + val->m_modifiable = 0; value_history.push_back (release_value (val)); @@ -2323,7 +2323,7 @@ value_of_internalvar (struct gdbarch *gdbarch, struct internalvar *var) want. */ if (var->kind != INTERNALVAR_MAKE_VALUE - && val->lval != lval_computed) + && val->m_lval != lval_computed) { VALUE_LVAL (val) = lval_internalvar; VALUE_INTERNALVAR (val) = var; @@ -2427,7 +2427,7 @@ set_internalvar (struct internalvar *var, struct value *val) default: new_kind = INTERNALVAR_VALUE; struct value *copy = value_copy (val); - copy->modifiable = 1; + copy->m_modifiable = 1; /* 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 @@ -2618,11 +2618,11 @@ void preserve_one_value (struct value *value, struct objfile *objfile, htab_t copied_types) { - if (value->type->objfile_owner () == objfile) - value->type = copy_type_recursive (value->type, copied_types); + if (value->m_type->objfile_owner () == objfile) + value->m_type = copy_type_recursive (value->m_type, copied_types); - if (value->enclosing_type->objfile_owner () == objfile) - value->enclosing_type = copy_type_recursive (value->enclosing_type, + if (value->m_enclosing_type->objfile_owner () == objfile) + value->m_enclosing_type = copy_type_recursive (value->m_enclosing_type, copied_types); } @@ -2753,9 +2753,9 @@ value_from_xmethod (xmethod_worker_up &&worker) struct value *v; v = allocate_value (builtin_type (target_gdbarch ())->xmethod); - v->lval = lval_xcallable; - v->location.xm_worker = worker.release (); - v->modifiable = 0; + v->m_lval = lval_xcallable; + v->m_location.xm_worker = worker.release (); + v->m_modifiable = 0; return v; } @@ -2766,9 +2766,9 @@ struct type * result_type_of_xmethod (struct value *method, gdb::array_view argv) { gdb_assert (value_type (method)->code () == TYPE_CODE_XMETHOD - && method->lval == lval_xcallable && !argv.empty ()); + && method->m_lval == lval_xcallable && !argv.empty ()); - return method->location.xm_worker->get_result_type (argv[0], argv.slice (1)); + return method->m_location.xm_worker->get_result_type (argv[0], argv.slice (1)); } /* Call the xmethod corresponding to the TYPE_CODE_XMETHOD value METHOD. */ @@ -2777,9 +2777,9 @@ struct value * call_xmethod (struct value *method, gdb::array_view argv) { gdb_assert (value_type (method)->code () == TYPE_CODE_XMETHOD - && method->lval == lval_xcallable && !argv.empty ()); + && method->m_lval == lval_xcallable && !argv.empty ()); - return method->location.xm_worker->invoke (argv[0], argv.slice (1)); + return method->m_location.xm_worker->invoke (argv[0], argv.slice (1)); } /* Extract a value as a C number (either long or double). @@ -3088,12 +3088,12 @@ set_value_enclosing_type (struct value *val, struct type *new_encl_type) if (new_encl_type->length () > value_enclosing_type (val)->length ()) { check_type_length_before_alloc (new_encl_type); - val->contents - .reset ((gdb_byte *) xrealloc (val->contents.release (), + val->m_contents + .reset ((gdb_byte *) xrealloc (val->m_contents.release (), new_encl_type->length ())); } - val->enclosing_type = new_encl_type; + val->m_enclosing_type = new_encl_type; } /* Given a value ARG1 (offset by OFFSET bytes) @@ -3136,15 +3136,15 @@ value_primitive_field (struct value *arg1, LONGEST offset, LONGEST container_bitsize = type->length () * 8; v = allocate_value_lazy (type); - v->bitsize = TYPE_FIELD_BITSIZE (arg_type, fieldno); - if ((bitpos % container_bitsize) + v->bitsize <= container_bitsize + v->m_bitsize = TYPE_FIELD_BITSIZE (arg_type, fieldno); + if ((bitpos % container_bitsize) + v->m_bitsize <= container_bitsize && type->length () <= (int) sizeof (LONGEST)) - v->bitpos = bitpos % container_bitsize; + v->m_bitpos = bitpos % container_bitsize; else - v->bitpos = bitpos % 8; - v->offset = (value_embedded_offset (arg1) + v->m_bitpos = bitpos % 8; + v->m_offset = (value_embedded_offset (arg1) + offset - + (bitpos - v->bitpos) / 8); + + (bitpos - v->m_bitpos) / 8); set_value_parent (v, arg1); if (!value_lazy (arg1)) value_fetch_lazy (v); @@ -3180,9 +3180,9 @@ value_primitive_field (struct value *arg1, LONGEST offset, value_contents_copy_raw (v, 0, arg1, 0, value_enclosing_type (arg1)->length ()); } - v->type = type; - v->offset = value_offset (arg1); - v->embedded_offset = offset + value_embedded_offset (arg1) + boffset; + v->m_type = type; + v->m_offset = value_offset (arg1); + v->m_embedded_offset = offset + value_embedded_offset (arg1) + boffset; } else if (NULL != TYPE_DATA_LOCATION (type)) { @@ -3214,7 +3214,7 @@ value_primitive_field (struct value *arg1, LONGEST offset, arg1, value_embedded_offset (arg1) + offset, type_length_units (type)); } - v->offset = (value_offset (arg1) + offset + v->m_offset = (value_offset (arg1) + offset + value_embedded_offset (arg1)); } set_value_component_location (v, arg1); @@ -3615,7 +3615,7 @@ value_zero (struct type *type, enum lval_type lv) struct value *val = allocate_value_lazy (type); VALUE_LVAL (val) = (lv == lval_computed ? not_lval : lv); - val->is_zero = true; + val->m_is_zero = true; return val; } @@ -3816,7 +3816,7 @@ value_from_component (struct value *whole, struct type *type, LONGEST offset) whole, value_embedded_offset (whole) + offset, type_length_units (type)); } - v->offset = value_offset (whole) + offset + value_embedded_offset (whole); + v->m_offset = value_offset (whole) + offset + value_embedded_offset (whole); set_value_component_location (v, whole); return v; @@ -3983,7 +3983,7 @@ using_struct_return (struct gdbarch *gdbarch, void set_value_initialized (struct value *val, int status) { - val->initialized = status; + val->m_initialized = status; } /* Return the initialized field in a value struct. */ @@ -3991,7 +3991,7 @@ set_value_initialized (struct value *val, int status) int value_initialized (const struct value *val) { - return val->initialized; + return val->m_initialized; } /* Helper for value_fetch_lazy when the value is a bitfield. */ @@ -4166,9 +4166,9 @@ value_fetch_lazy (struct value *val) /* A value is either lazy, or fully fetched. The availability/validity is only established as we try to fetch a value. */ - gdb_assert (val->optimized_out.empty ()); - gdb_assert (val->unavailable.empty ()); - if (val->is_zero) + gdb_assert (val->m_optimized_out.empty ()); + gdb_assert (val->m_unavailable.empty ()); + if (val->m_is_zero) { /* Nothing. */ }