From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway34.websitewelcome.com (gateway34.websitewelcome.com [192.185.148.164]) by sourceware.org (Postfix) with ESMTPS id 1D0263877030 for ; Sat, 28 Mar 2020 19:22:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1D0263877030 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway34.websitewelcome.com (Postfix) with ESMTP id BA812844808 for ; Sat, 28 Mar 2020 14:22:10 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id IH22jzbohAGTXIH22jNzxw; Sat, 28 Mar 2020 14:22:10 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: 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=X1eatcqlfmDkzRUbp80qTitqsTkuS8QeghxYNdKSJYE=; b=DqVBkKYIGQjjqY7dHngWn9s5Nm 0lqzE2a7+KP0P9ngivoto+fO/hhhHwVE6ekg+hZ2PSSqMCs8kO9FAkDwnLsAlNNhLlKDSAuWivoyw RbXV7pagkp8oY2P+aY4Te8Khq; Received: from 97-118-117-21.hlrn.qwest.net ([97.118.117.21]:55190 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1jIH22-003oZR-H2; Sat, 28 Mar 2020 13:22:10 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 02/20] Rename struct attribute accessors Date: Sat, 28 Mar 2020 13:21:50 -0600 Message-Id: <20200328192208.11324-3-tom@tromey.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200328192208.11324-1-tom@tromey.com> References: <20200328192208.11324-1-tom@tromey.com> 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: 97.118.117.21 X-Source-L: No X-Exim-ID: 1jIH22-003oZR-H2 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-118-117-21.hlrn.qwest.net (bapiya.Home) [97.118.117.21]:55190 X-Source-Auth: tom+tromey.com X-Email-Count: 5 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-20.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, JMQ_SPF_NEUTRAL, KAM_STOCKGEN, RCVD_IN_ABUSEAT, RCVD_IN_DNSWL_NONE, RCVD_IN_SBL_CSS, SPF_HELO_PASS, SPF_NEUTRAL, TXREP, URIBL_CSS, URIBL_CSS_A 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: Sat, 28 Mar 2020 19:22:12 -0000 This removes the "value_as_" prefix from the struct value accessors. This seemed unnecessarily wordy to me. gdb/ChangeLog 2020-03-28 Tom Tromey * dwarf2/read.c (dwarf2_find_base_address, read_call_site_scope) (dwarf2_get_pc_bounds, dwarf2_record_block_ranges) (partial_die_info::read, dwarf2_string_attr, new_symbol): Update. * dwarf2/attribute.h (struct attribute): Rename methods. * dwarf2/attribute.c (attribute::address): Rename from value_as_address. (attribute::string): Rename from value_as_string. --- gdb/ChangeLog | 10 ++++++++++ gdb/dwarf2/attribute.c | 4 ++-- gdb/dwarf2/attribute.h | 4 ++-- gdb/dwarf2/read.c | 24 ++++++++++++------------ 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/gdb/dwarf2/attribute.c b/gdb/dwarf2/attribute.c index a4a6db76c8f..1bdd4cf7abb 100644 --- a/gdb/dwarf2/attribute.c +++ b/gdb/dwarf2/attribute.c @@ -32,7 +32,7 @@ /* See attribute.h. */ CORE_ADDR -attribute::value_as_address () const +attribute::address () const { CORE_ADDR addr; @@ -62,7 +62,7 @@ attribute::value_as_address () const /* See attribute.h. */ const char * -attribute::value_as_string () const +attribute::string () const { if (form == DW_FORM_strp || form == DW_FORM_line_strp || form == DW_FORM_string diff --git a/gdb/dwarf2/attribute.h b/gdb/dwarf2/attribute.h index a9cabd69f9f..cefd3c5541e 100644 --- a/gdb/dwarf2/attribute.h +++ b/gdb/dwarf2/attribute.h @@ -44,11 +44,11 @@ struct attribute { /* Read the given attribute value as an address, taking the attribute's form into account. */ - CORE_ADDR value_as_address () const; + CORE_ADDR address () const; /* If the attribute has a string form, return the string value; otherwise return NULL. */ - const char *value_as_string () const; + const char *string () const; /* Return non-zero if ATTR's value is a section offset --- classes lineptr, loclistptr, macptr or rangelistptr --- or zero, otherwise. diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 98323f8920b..d2b274a6e3a 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -5766,12 +5766,12 @@ dwarf2_find_base_address (struct die_info *die, struct dwarf2_cu *cu) attr = dwarf2_attr (die, DW_AT_entry_pc, cu); if (attr != nullptr) - cu->base_address = attr->value_as_address (); + cu->base_address = attr->address (); else { attr = dwarf2_attr (die, DW_AT_low_pc, cu); if (attr != nullptr) - cu->base_address = attr->value_as_address (); + cu->base_address = attr->address (); } } @@ -13022,7 +13022,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) sect_offset_str (die->sect_off), objfile_name (objfile)); return; } - pc = attr->value_as_address () + baseaddr; + pc = attr->address () + baseaddr; pc = gdbarch_adjust_dwarf2_addr (gdbarch, pc); if (cu->call_site_htab == NULL) @@ -13724,8 +13724,8 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, attr = dwarf2_attr (die, DW_AT_low_pc, cu); if (attr != nullptr) { - low = attr->value_as_address (); - high = attr_high->value_as_address (); + low = attr->address (); + high = attr_high->address (); if (cu->header.version >= 4 && attr_high->form_is_constant ()) high += low; } @@ -13897,8 +13897,8 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block, attr = dwarf2_attr (die, DW_AT_low_pc, cu); if (attr != nullptr) { - CORE_ADDR low = attr->value_as_address (); - CORE_ADDR high = attr_high->value_as_address (); + CORE_ADDR low = attr->address (); + CORE_ADDR high = attr_high->address (); if (cu->header.version >= 4 && attr_high->form_is_constant ()) high += low; @@ -17896,15 +17896,15 @@ partial_die_info::read (const struct die_reader_specs *reader, /* Note that both forms of linkage name might appear. We assume they will be the same, and we only store the last one we see. */ - linkage_name = attr.value_as_string (); + linkage_name = attr.string (); break; case DW_AT_low_pc: has_low_pc_attr = 1; - lowpc = attr.value_as_address (); + lowpc = attr.address (); break; case DW_AT_high_pc: has_high_pc_attr = 1; - highpc = attr.value_as_address (); + highpc = attr.address (); if (cu->header.version >= 4 && attr.form_is_constant ()) high_pc_relative = 1; break; @@ -18949,7 +18949,7 @@ dwarf2_string_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *c if (attr != NULL) { - str = attr->value_as_string (); + str = attr->string (); if (str == nullptr) complaint (_("string type expected for attribute %s for " "DIE at %s in module %s"), @@ -20076,7 +20076,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, { CORE_ADDR addr; - addr = attr->value_as_address (); + addr = attr->address (); addr = gdbarch_adjust_dwarf2_addr (gdbarch, addr + baseaddr); SET_SYMBOL_VALUE_ADDRESS (sym, addr); } -- 2.17.2