From: "Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>
To: Tom Tromey <tom@tromey.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCH 02/20] Rename struct attribute accessors
Date: Mon, 30 Mar 2020 08:58:53 +0000 [thread overview]
Message-ID: <SN6PR11MB289335D6925981A2848EC4C7C4CB0@SN6PR11MB2893.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20200328192208.11324-3-tom@tromey.com>
On Saturday, March 28, 2020 8:22 PM, Tom Tromey wrote:
> This removes the "value_as_" prefix from the struct value accessors.
> This seemed unnecessarily wordy to me.
>
> gdb/ChangeLog
> 2020-03-28 Tom Tromey <tom@tromey.com>
>
> * 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 ();
The existing code had 8 spaces that can now be replaced with a tab.
Thanks.
-Baris
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
next prev parent reply other threads:[~2020-03-30 8:58 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-28 19:21 [PATCH 00/20] Make DWARF attribute references safe Tom Tromey
2020-03-28 19:21 ` [PATCH 01/20] Add attribute::value_as_string method Tom Tromey
2020-03-28 19:21 ` [PATCH 02/20] Rename struct attribute accessors Tom Tromey
2020-03-30 8:58 ` Aktemur, Tankut Baris [this message]
2020-03-30 23:39 ` Tom Tromey
2020-03-30 14:45 ` Simon Marchi
2020-03-30 23:39 ` Tom Tromey
2020-03-28 19:21 ` [PATCH 03/20] Avoid using DW_* macros in dwarf2/attribute.c Tom Tromey
2020-03-28 19:21 ` [PATCH 04/20] Change some uses of DW_STRING to string method Tom Tromey
2020-03-30 14:56 ` Simon Marchi
2020-03-30 23:53 ` Tom Tromey
2020-03-28 19:21 ` [PATCH 05/20] Remove some uses of DW_STRING_IS_CANONICAL Tom Tromey
2020-03-30 15:02 ` Simon Marchi
2020-03-31 0:01 ` Tom Tromey
2020-03-28 19:21 ` [PATCH 06/20] Remove DW_STRING and DW_STRING_IS_CANONICAL Tom Tromey
2020-03-30 15:10 ` Simon Marchi
2020-03-31 0:23 ` Tom Tromey
2020-03-28 19:21 ` [PATCH 07/20] Remove DW_BLOCK Tom Tromey
2020-03-30 15:13 ` Simon Marchi
2020-03-28 19:21 ` [PATCH 08/20] Remove DW_SIGNATURE Tom Tromey
2020-03-28 19:21 ` [PATCH 09/20] Remove DW_SND Tom Tromey
2020-03-28 19:21 ` [PATCH 10/20] Use setter for attribute's unsigned value Tom Tromey
2020-03-28 19:21 ` [PATCH 11/20] Add reprocessing flag to struct attribute Tom Tromey
2020-03-30 15:32 ` Simon Marchi
2020-04-04 14:02 ` Tom Tromey
2020-03-28 19:22 ` [PATCH 12/20] Remove DW_ADDR Tom Tromey
2020-03-30 15:40 ` Simon Marchi
2020-04-04 14:05 ` Tom Tromey
2020-03-28 19:22 ` [PATCH 13/20] Change how reprocessing is done Tom Tromey
2020-03-30 15:46 ` Simon Marchi
2020-04-04 14:14 ` Tom Tromey
2020-03-28 19:22 ` [PATCH 14/20] Change how accessibility is handled in dwarf2/read.c Tom Tromey
2020-03-30 15:50 ` Simon Marchi
2020-03-28 19:22 ` [PATCH 15/20] Add attribute::get_unsigned method Tom Tromey
2020-03-30 15:57 ` Simon Marchi
2020-04-04 14:17 ` Tom Tromey
2020-03-28 19:22 ` [PATCH 16/20] Change is_valid_DW_AT_defaulted to a method on attribute Tom Tromey
2020-03-30 16:00 ` Simon Marchi
2020-04-04 14:23 ` Tom Tromey
2020-03-28 19:22 ` [PATCH 17/20] Change die_info methods to check the attribute's form Tom Tromey
2020-03-30 16:02 ` Simon Marchi
2020-03-30 19:04 ` Tom Tromey
2020-03-30 20:18 ` Simon Marchi
2020-03-30 20:26 ` Tom Tromey
2020-03-28 19:22 ` [PATCH 18/20] Add attribute::virtuality method Tom Tromey
2020-03-28 19:22 ` [PATCH 19/20] Add attribute::boolean method Tom Tromey
2020-03-28 19:22 ` [PATCH 20/20] Remove DW_UNSND Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=SN6PR11MB289335D6925981A2848EC4C7C4CB0@SN6PR11MB2893.namprd11.prod.outlook.com \
--to=tankut.baris.aktemur@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).