From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id TDQUNLj86GkzATQAWB0awg (envelope-from ) for ; Wed, 22 Apr 2026 12:52:08 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=iIERhG7z; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id C25051E093; Wed, 22 Apr 2026 12:52:08 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=no autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 80C791E093 for ; Wed, 22 Apr 2026 12:52:07 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 035624BAE7FB for ; Wed, 22 Apr 2026 16:52:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 035624BAE7FB Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=iIERhG7z Received: from omta38.uswest2.a.cloudfilter.net (omta38.uswest2.a.cloudfilter.net [35.89.44.37]) by sourceware.org (Postfix) with ESMTPS id E29E84BAE7F3 for ; Wed, 22 Apr 2026 16:51:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E29E84BAE7F3 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E29E84BAE7F3 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776876701; cv=none; b=Q8KvVI3qhlF73jnBXJQusIILzfXIRm4vXz78vMRTynualSf89rMS67kSZO5/I5Ba+ofN7uLrclmRA4Xo7D0pDVRk17p/aiLtqrjWTdbE6hkbfkTLi+HG0scJM5OXr/F9u1HVeMbmZZqySOi7yJ3MeMXf3v1mp2ety7auRelfmMs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776876701; c=relaxed/simple; bh=4qfmC2RfBxbWICgDqvU5zjybJg48iLX3V/avsej0+Vk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=F5a5ti67dvi5VUOKyGPr23vlN4+7WTHyl3FOCRvd3tUzbxkkaa1iDNeeLnmJXclF8mBMtc5bBEB9R/pMAUJecxAW2zyIjns9QjUt4+Z5JIZCIBcVmIn3rP1AZazoitSrZOzbAa+wKtSZJHoIYTdK7achB9zVKrk5mPDdTUaZGIA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E29E84BAE7F3 Received: from eig-obgw-5007b.ext.cloudfilter.net ([10.0.29.167]) by cmsmtp with ESMTPS id FZ3awWlPzjw8YFanbwFK5T; Wed, 22 Apr 2026 16:51:39 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id FanVwKbXvxUZ2FanVwNlT2; Wed, 22 Apr 2026 16:51:34 +0000 X-Authority-Analysis: v=2.4 cv=HJHDFptv c=1 sm=1 tr=0 ts=69e8fc9b a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=A5OVakUREuEA:10 a=ItBw4LHWJt0A:10 a=zstS-IiYAAAA:8 a=6fdACszIs7_TmTzPUCMA:9 a=4G6NA9xxw8l3yy4pmD5M:22 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=C2XmqUSNkHmeVjAd87YH2lNj6QiE/00NUcM28kRG2QE=; b=iIERhG7zPtkDrfubxq5tmMByWL hpRLEzlPyrXDNKb4iCFatQm+GQosflTx733I7ql9w+Yz0cC1kUPtuTcfg13xmkZSRoZ70xtUY114r l5B2MIbXAZxQxVDmqDipu7vuw; Received: from 75-166-225-82.hlrn.qwest.net ([75.166.225.82]:46634 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wFanV-00000003dgK-1DBV; Wed, 22 Apr 2026 10:51:33 -0600 From: Tom Tromey To: Tom de Vries Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] [gdb/symtab] Factor out new_symbol_file_line In-Reply-To: <20260421160307.1655903-1-tdevries@suse.de> (Tom de Vries's message of "Tue, 21 Apr 2026 18:03:07 +0200") References: <20260421160307.1655903-1-tdevries@suse.de> X-Attribution: Tom Date: Wed, 22 Apr 2026 10:51:32 -0600 Message-ID: <87jytzq6p7.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain 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.225.82 X-Source-L: No X-Exim-ID: 1wFanV-00000003dgK-1DBV X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-225-82.hlrn.qwest.net (bapiya) [75.166.225.82]:46634 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfMJow9k3koctcPOakhW2/xx8ltvq1OuRKnKTYUZdNtgLsoEz62mvueEM7VpH782w+jifLtfIPrI3NP/O+ulhxqz9yx6+KRPWbSfUooIjKRj6sf95JLFj O0n0YghE3IkbI1D4iew+o76UKBXSwi/s7V/n//PIxLjtessLVO2BGGGW02VA2c37y9jYy7KLJuhOJPOih2Z0v8pFxW6fU9fPpDs= X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org >>>>> "Tom" == Tom de Vries writes: Tom> I was looking at a patch [1] modifying the DW_AT_decl_file / DW_AT_call_file Tom> handling of new_symbol, and noticed that: Tom> - the code is fairly nested, and Tom> - the patch adds another nesting layer. Tom> Factor out function new_symbol_file_line out of new_symbol, handling both the Tom> DW_AT_decl_file / DW_AT_call_file and DW_AT_call_line / DW_AT_decl_line Tom> attributes. Thanks for doing this. I think new_symbol really needs to be split up, the way it is now is pretty bad, and your patch is a nice step in that direction. Tom> Having factored out the code, simplify it using return, and modernize it using Tom> bool and nullptr. Tom> + struct attribute *attr = nullptr; Tom> + Tom> + bool inlined_func = (die->tag == DW_TAG_inlined_subroutine); Tom> + Tom> + /* Handle DW_AT_call_line / DW_AT_decl_line. */ Tom> + attr = dwarf2_attr (die, Tom> + inlined_func ? DW_AT_call_line : DW_AT_decl_line, Tom> + cu); This line could be combined with the declaration and then the initialization removed like attribute *attr = dwarf2_attr (...) Approved-By: Tom Tromey Tom