From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lndn.lancelotsix.com (lndn.lancelotsix.com [51.195.220.111]) by sourceware.org (Postfix) with ESMTPS id 7B6103858D1E for ; Mon, 30 Jan 2023 12:34:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7B6103858D1E Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=lancelotsix.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lancelotsix.com Received: from ubuntu.lan (unknown [IPv6:2a02:390:9086::146]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id 8AECD80E9E; Mon, 30 Jan 2023 12:34:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=lancelotsix.com; s=2021; t=1675082070; bh=dyVLHsmimPEZwXLDPNM23b/SvJpbO9BMWsqxT3CyyIA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ElIZScvsim7SsX60HXeolID+GnHXYU2vGdUpy+TQY7Y2n1Ty3sOjtikS+GkhgiAoS dT2EPTntiIsP2mBiEGEcy5ZOXJ2rDjHBWi9HL4Wuru/V5wqAuY24ouTJuBhbs0LwB6 w1klyAISBmGUMpwoGaTGgym5282JruJ0k5Ex0Inc56eWdJHHu7UzdqdBdvxMxM3xoH Aa/rLYRmgr+SDhiIff24WPt/eHAQhMXEK3tADgOoopDDeIagvkYhke2vyTbO+HxClZ Z89a0MftjQhBRKR/GdwzYKrxTuyqUUAnXP72hsOU7Ab6l+ckd6yKP4XtCozlSyvV9k a89LS+KV4Kf2w== Date: Mon, 30 Jan 2023 12:34:09 +0000 From: Lancelot SIX To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Clean up lnp_state_machine constructor Message-ID: <20230130123409.uinmi5xuj2jhkltt@ubuntu.lan> References: <20230130042537.909340-1-tom@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230130042537.909340-1-tom@tromey.com> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.11 (lndn.lancelotsix.com [0.0.0.0]); Mon, 30 Jan 2023 12:34:30 +0000 (UTC) X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi, I went through this patch, and FWIW, this looks good to me. Reviewed-By: Lancelot Six 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 >