public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Lancelot SIX <lsix@lancelotsix.com>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Clean up lnp_state_machine constructor
Date: Mon, 30 Jan 2023 12:34:09 +0000	[thread overview]
Message-ID: <20230130123409.uinmi5xuj2jhkltt@ubuntu.lan> (raw)
In-Reply-To: <20230130042537.909340-1-tom@tromey.com>

Hi,

I went through this patch, and FWIW, this looks good to me.

Reviewed-By: Lancelot Six <lancelot.six@amd.com>

Best,
Lancelot.

On Sun, Jan 29, 2023 at 09:25:37PM -0700, Tom Tromey wrote:
> This changes the lnp_state_machine constructor to initialize members
> directly; and changes lnp_state_machine itself to initialize members
> inline when possible.
> ---
>  gdb/dwarf2/read.c | 33 +++++++++++++--------------------
>  1 file changed, 13 insertions(+), 20 deletions(-)
> 
> diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
> index cd937f24ee7..97f99160443 100644
> --- a/gdb/dwarf2/read.c
> +++ b/gdb/dwarf2/read.c
> @@ -20073,7 +20073,7 @@ class lnp_state_machine
>  
>    CORE_ADDR m_address;
>    linetable_entry_flags m_flags;
> -  unsigned int m_discriminator;
> +  unsigned int m_discriminator = 0;
>  
>    /* Additional bits of state we need to track.  */
>  
> @@ -20093,7 +20093,7 @@ class lnp_state_machine
>    bool m_stmt_at_address = false;
>  
>    /* When true, record the lines we decode.  */
> -  bool m_currently_recording_lines = false;
> +  bool m_currently_recording_lines = true;
>  
>    /* The last line number that was recorded, used to coalesce
>       consecutive entries for the same line.  This can happen, for
> @@ -20346,25 +20346,18 @@ lnp_state_machine::record_line (bool end_sequence)
>  
>  lnp_state_machine::lnp_state_machine (struct dwarf2_cu *cu, gdbarch *arch,
>  				      line_header *lh)
> +  : m_cu (cu),
> +    m_gdbarch (arch),
> +    m_line_header (lh),
> +    /* Call `gdbarch_adjust_dwarf2_line' on the initial 0 address as
> +       if there was a line entry for it so that the backend has a
> +       chance to adjust it and also record it in case it needs it.
> +       This is currently used by MIPS code,
> +       cf. `mips_adjust_dwarf2_line'.  */
> +    m_address (gdbarch_adjust_dwarf2_line (arch, 0, 0)),
> +    m_flags (lh->default_is_stmt ? LEF_IS_STMT : (linetable_entry_flags) 0),
> +    m_last_address (m_address)
>  {
> -  m_cu = cu;
> -  m_gdbarch = arch;
> -  m_line_header = lh;
> -
> -  m_currently_recording_lines = true;
> -
> -  /* Call `gdbarch_adjust_dwarf2_line' on the initial 0 address as if there
> -     was a line entry for it so that the backend has a chance to adjust it
> -     and also record it in case it needs it.  This is currently used by MIPS
> -     code, cf. `mips_adjust_dwarf2_line'.  */
> -  m_address = gdbarch_adjust_dwarf2_line (arch, 0, 0);
> -  m_flags = 0;
> -  if (lh->default_is_stmt)
> -    m_flags |= LEF_IS_STMT;
> -  m_discriminator = 0;
> -
> -  m_last_address = m_address;
> -  m_stmt_at_address = false;
>  }
>  
>  void
> -- 
> 2.39.1
> 

      reply	other threads:[~2023-01-30 12:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30  4:25 Tom Tromey
2023-01-30 12:34 ` Lancelot SIX [this message]

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=20230130123409.uinmi5xuj2jhkltt@ubuntu.lan \
    --to=lsix@lancelotsix.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).