From patchwork Mon Jan 30 04:25:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 63898 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 21FBF3858D38 for ; Mon, 30 Jan 2023 04:26:09 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from gproxy3-pub.mail.unifiedlayer.com (gproxy3-pub.mail.unifiedlayer.com [69.89.30.42]) by sourceware.org (Postfix) with ESMTPS id 5C7473858D38 for ; Mon, 30 Jan 2023 04:25:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5C7473858D38 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from cmgw13.mail.unifiedlayer.com (unknown [10.0.90.128]) by progateway5.mail.pro1.eigbox.com (Postfix) with ESMTP id A696F1004B4F8 for ; Mon, 30 Jan 2023 04:25:55 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id MLjvplCq1NX2aMLjvpXVnv; Mon, 30 Jan 2023 04:25:55 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=NMAQR22g c=1 sm=1 tr=0 ts=63d746d3 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=RvmDmJFTN0MA:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=7gbeyqm39WSzBSRd4eAA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=gIDpIidIh0ekWAclypZiZQMjGe/0eTHqcgkyFpZaWjk=; b=TDWLXHmPvljsPhiuLgT/4dvg2K M3/9a6BdoQVPb2WG2UKnq0aU3b0c/osO38dKz9ziuXhA+vnA/580zE80nGNuaFOKmQSD8eHCKB7Op QQBBuSvMdEemPRqrCf9Qw8LVq; Received: from 75-166-146-144.hlrn.qwest.net ([75.166.146.144]:55252 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pMLjv-002KvL-GE; Sun, 29 Jan 2023 21:25:55 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Clean up lnp_state_machine constructor Date: Sun, 29 Jan 2023 21:25:37 -0700 Message-Id: <20230130042537.909340-1-tom@tromey.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 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: 75.166.146.144 X-Source-L: No X-Exim-ID: 1pMLjv-002KvL-GE X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-146-144.hlrn.qwest.net (localhost.localdomain) [75.166.146.144]:55252 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3027.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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 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: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" This changes the lnp_state_machine constructor to initialize members directly; and changes lnp_state_machine itself to initialize members inline when possible. Reviewed-By: Lancelot Six --- 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