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 15FF1396DC1A for ; Thu, 30 Apr 2020 18:17:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 15FF1396DC1A X-ASG-Debug-ID: 1588270674-0c856e314b604450001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id wAaxIy5cE6HYE6Pd (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 30 Apr 2020 14:17:54 -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 DB745441B21; Thu, 30 Apr 2020 14:17:54 -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 Cc: Simon Marchi Subject: [PATCH 3/4] gdb: make remove_dyn_prop a method of struct type Date: Thu, 30 Apr 2020 14:17:52 -0400 X-ASG-Orig-Subj: [PATCH 3/4] gdb: make remove_dyn_prop a method of struct type Message-Id: <20200430181753.1093-4-simon.marchi@efficios.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200430181753.1093-1-simon.marchi@efficios.com> References: <20200430181753.1093-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: 1588270674 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: 3998 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.81535 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M X-Spam-Status: No, score=-39.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, 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: Thu, 30 Apr 2020 18:17:57 -0000 Move remove_dyn_prop, currently a free function, to be a method of struct type. gdb/ChangeLog: * gdbtypes.h (struct type) : New method. (remove_dyn_prop): Remove. Update all users to use type::remove_dyn_prop. * gdbtypes.c (remove_dyn_prop): Rename to... (type::remove_dyn_prop): ... this. --- gdb/gdbtypes.c | 15 +++++++-------- gdb/gdbtypes.h | 6 +++--- gdb/value.c | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 3fc14e9cfb9..566c6c4f063 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -2185,7 +2185,7 @@ resolve_dynamic_array_or_string (struct type *type, { if (dwarf2_evaluate_property (prop, NULL, addr_stack, &value)) { - remove_dyn_prop (DYN_PROP_BYTE_STRIDE, type); + type->remove_dyn_prop (DYN_PROP_BYTE_STRIDE); bit_stride = (unsigned int) (value * 8); } else @@ -2603,7 +2603,7 @@ resolve_dynamic_type_internal (struct type *type, if (type_length.has_value ()) { TYPE_LENGTH (resolved_type) = *type_length; - remove_dyn_prop (DYN_PROP_BYTE_SIZE, resolved_type); + resolved_type->remove_dyn_prop (DYN_PROP_BYTE_SIZE); } /* Resolve data_location attribute. */ @@ -2665,27 +2665,26 @@ type::add_dyn_prop (dynamic_prop_node_kind prop_kind, dynamic_prop prop) TYPE_DYN_PROP_LIST (this) = temp; } -/* Remove dynamic property from TYPE in case it exists. */ +/* See gdbtypes.h. */ void -remove_dyn_prop (enum dynamic_prop_node_kind prop_kind, - struct type *type) +type::remove_dyn_prop (dynamic_prop_node_kind kind) { struct dynamic_prop_list *prev_node, *curr_node; - curr_node = TYPE_DYN_PROP_LIST (type); + curr_node = TYPE_DYN_PROP_LIST (this); prev_node = NULL; while (NULL != curr_node) { - if (curr_node->prop_kind == prop_kind) + if (curr_node->prop_kind == kind) { /* Update the linked list but don't free anything. The property was allocated on objstack and it is not known if we are on top of it. Nevertheless, everything is released when the complete objstack is freed. */ if (NULL == prev_node) - TYPE_DYN_PROP_LIST (type) = curr_node->next; + TYPE_DYN_PROP_LIST (this) = curr_node->next; else prev_node->next = curr_node->next; diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index cd03f921d80..50edcca841c 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -896,6 +896,9 @@ struct type This function assumes that this type is objfile-owned. */ void add_dyn_prop (dynamic_prop_node_kind kind, dynamic_prop prop); + /* * Remove dynamic property of kind KIND from this type, if it exists. */ + void remove_dyn_prop (dynamic_prop_node_kind kind); + /* * Type that is a pointer to this type. NULL if no such pointer-to type is known yet. The debugger may add the address of such a type @@ -2115,9 +2118,6 @@ extern struct type *resolve_dynamic_type /* * Predicate if the type has dynamic values, which are not resolved yet. */ extern int is_dynamic_type (struct type *type); -extern void remove_dyn_prop (enum dynamic_prop_node_kind prop_kind, - struct type *type); - extern struct type *check_typedef (struct type *); extern void check_stub_method_group (struct type *, int); diff --git a/gdb/value.c b/gdb/value.c index 7ea39af5551..aafbf0fc06b 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -2291,7 +2291,7 @@ set_internalvar (struct internalvar *var, struct value *val) when accessing the value. If we keep it, we would still refer to the origin value. Remove the location property in case it exist. */ - remove_dyn_prop (DYN_PROP_DATA_LOCATION, value_type (new_data.value)); + value_type (new_data.value)->remove_dyn_prop (DYN_PROP_DATA_LOCATION); break; } -- 2.26.2