Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Lancelot SIX via Gdb-patches <gdb-patches@sourceware.org>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 2/4] Minor cleanup to addrmap_index_data::previous_valid
Date: Sun, 13 Jun 2021 17:48:22 +0100	[thread overview]
Message-ID: <20210613164822.i3guvbgw5n5smie7@Plymouth> (raw)
In-Reply-To: <20210529135443.1446279-3-tom@tromey.com>

Hi

On Sat, May 29, 2021 at 07:54:41AM -0600, Tom Tromey wrote:
> This changes addrmap_index_data::previous_valid to a bool, and
> initializes it inline.
> 
> 2021-05-28  Tom Tromey  <tom@tromey.com>
> 
> 	* dwarf2/index-write.c (struct addrmap_index_data)
> 	<previous_valid>: Now bool.  Initialize.
> 	(add_address_entry_worker): Update.
> 	(write_address_map): Update.
> ---
>  gdb/ChangeLog            |  7 +++++++
>  gdb/dwarf2/index-write.c | 12 +++---------
>  2 files changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
> index ffc49e8ba82..656742f2e0a 100644
> --- a/gdb/dwarf2/index-write.c
> +++ b/gdb/dwarf2/index-write.c
> @@ -422,7 +422,7 @@ struct addrmap_index_data
>    /* Non-zero if the previous_* fields are valid.
>       We can't write an entry until we see the next entry (since it is only then
>       that we know the end of the entry).  */

The comment could also change from “Non-zero” to “true” to reflect the
type change, or even “Indicates if the previous_* fields are valid”.

Lancelot.

> -  int previous_valid;
> +  bool previous_valid = false;
>    /* Index of the CU in the table of all CUs in the index file.  */
>    unsigned int previous_cu_index;
>    /* Start address of the CU.  */
> @@ -459,10 +459,10 @@ add_address_entry_worker (void *datap, CORE_ADDR start_addr, void *obj)
>        const auto it = data->cu_index_htab.find (pst);
>        gdb_assert (it != data->cu_index_htab.cend ());
>        data->previous_cu_index = it->second;
> -      data->previous_valid = 1;
> +      data->previous_valid = true;
>      }
>    else
> -    data->previous_valid = 0;
> +    data->previous_valid = false;
>  
>    return 0;
>  }
> @@ -477,12 +477,6 @@ write_address_map (dwarf2_per_bfd *per_bfd, data_buf &addr_vec,
>  {
>    struct addrmap_index_data addrmap_index_data (addr_vec, cu_index_htab);
>  
> -  /* When writing the address table, we have to cope with the fact that
> -     the addrmap iterator only provides the start of a region; we have to
> -     wait until the next invocation to get the start of the next region.  */
> -
> -  addrmap_index_data.previous_valid = 0;
> -
>    addrmap_foreach (per_bfd->partial_symtabs->psymtabs_addrmap,
>  		   add_address_entry_worker, &addrmap_index_data);
>  
> -- 
> 2.26.3
> 

  reply	other threads:[~2021-06-13 16:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-29 13:54 [PATCH 0/4] Some small debug index writer cleanups Tom Tromey
2021-05-29 13:54 ` [PATCH 1/4] Fix oddity in write_gdbindex Tom Tromey
2021-05-29 13:54 ` [PATCH 2/4] Minor cleanup to addrmap_index_data::previous_valid Tom Tromey
2021-06-13 16:48   ` Lancelot SIX via Gdb-patches [this message]
2021-06-14 20:14     ` Tom Tromey
2021-05-29 13:54 ` [PATCH 3/4] Simplify gdb_index writing Tom Tromey
2021-05-29 13:54 ` [PATCH 4/4] Simplify debug_names index writing Tom Tromey
2021-07-05 17:56 ` [PATCH 0/4] Some small debug index writer cleanups 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=20210613164822.i3guvbgw5n5smie7@Plymouth \
    --to=gdb-patches@sourceware.org \
    --cc=lsix@lancelotsix.com \
    --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