From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 1m0wIFEY6mnDSDYAWB0awg (envelope-from ) for ; Thu, 23 Apr 2026 09:02:09 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=AVOoQnBp; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Nj2bfzzd; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=UYhpc/FA; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=9s3RjsDy; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 70BF51E067; Thu, 23 Apr 2026 09:02:09 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham 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 8889A1E067 for ; Thu, 23 Apr 2026 09:02:07 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 4632A4B8A686 for ; Thu, 23 Apr 2026 13:02:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4632A4B8A686 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=AVOoQnBp; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Nj2bfzzd; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=UYhpc/FA; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=9s3RjsDy Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id B1A5F4B8E04B for ; Thu, 23 Apr 2026 13:01:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B1A5F4B8E04B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B1A5F4B8E04B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776949281; cv=none; b=IfGpduIR6smHYSf+lx/hQ4P0LIHDpJb9W+zQpekwh/XOaCUzrHTh8DiTVyZLXoKQty56JSgSt+gSl+Yqcs2vGjcrsB9yBLBpvrq6kE4mt4Wr/Nk3QhVZKeo0h/yU+oFDFAQyCh3DcDxvWGk6K6S6v4MFEQOHPdxklTGF+oHxum0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776949281; c=relaxed/simple; bh=6T31R8Sk2Cly1KtwJOTIyt+I/8tNTNvmoSmp88Wa3uM=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:To:From; b=A8uwqfjlSTWgMPy0JgQOZtElo/kxUjdA9CAa+pYN6BRZHH0gMP4K2s7Zib4GBzcyBWOS3mnbz8MeUYM6iSoCgHJFHwJYXM8qXQVr3bqwNbZNtNG7X/Gl/65eGbd3c8yMKAJOJFf9hozAw0vMLRM8v+nZGfb6r1u9AUA0y5LNbhM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B1A5F4B8E04B Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 967415BD80; Thu, 23 Apr 2026 13:01:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1776949275; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oBe6DBhuDHkMB7ZBd1l4pW2V7+MQIzZv8VQdPdHQ2QA=; b=AVOoQnBpmfPUzbZRWlcK/gNYEPV8JCx/unujHHeylTby9HJjTk3uGHA8YwWIF24zN3siDy eFReY1jw2+VQwbuC71dfNgwxK4Ku4XRg5ObXE13yDlSMGk05jJQ/Hi+53/cbPTFgi+g/c0 ZnHK5rG8HUpvNkHM2FHFleSiuNF6wD4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1776949275; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oBe6DBhuDHkMB7ZBd1l4pW2V7+MQIzZv8VQdPdHQ2QA=; b=Nj2bfzzdrXZmG4ZYl+EAhiKf6NHgmLRBP11+8i3C5uvgEQJobmjoB2H2mV0XCSVoXniCde v3rLbKMKHbg/4iBg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="UYhpc/FA"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=9s3RjsDy DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1776949270; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oBe6DBhuDHkMB7ZBd1l4pW2V7+MQIzZv8VQdPdHQ2QA=; b=UYhpc/FAtyRXR+LmL67O8+KLvo+OYdPNicTtmnVOq4ixf2eDXIzw6sZbhkz41JJyAg2ZOi LO1VMlPmW5bxbw81luu0SmhDT/+Qfc3rD8jk5RzRDZMrQtWDjEzGKnYVLErljxchvZdSd6 IFco/cvyO2C1pNbgTO8+EB6Rh0w39mc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1776949270; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oBe6DBhuDHkMB7ZBd1l4pW2V7+MQIzZv8VQdPdHQ2QA=; b=9s3RjsDyfLybHoWzbljQwzFOsBVSony6B8jEj6Sjj7vSX07/Q70vq2bjZB7Qs2uoP3ttHf fLoS0ltL3pn7DOAQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 8265B593A3; Thu, 23 Apr 2026 13:01:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id iIaUHhYY6mkLEwAAD6G6ig (envelope-from ); Thu, 23 Apr 2026 13:01:10 +0000 Message-ID: <5ab6406d-b9f6-4866-8be1-a2f98b3c848f@suse.de> Date: Thu, 23 Apr 2026 15:01:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] [gdb/symtab] Factor out new_symbol_file_line To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20260421160307.1655903-1-tdevries@suse.de> <87jytzq6p7.fsf@tromey.com> Content-Language: en-US From: Tom de Vries In-Reply-To: <87jytzq6p7.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RSPAMD_EMAILBL_FAIL(0.00)[tom.tromey.com:query timed out]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim,suse.de:mid,suse.de:email,tromey.com:email,sourceware.org:url]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Queue-Id: 967415BD80 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 On 4/22/26 6:51 PM, Tom Tromey wrote: >>>>>> "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. > Hi Tom, Thanks for the review, pushed with the nit pointed out below fixed. I don't know whether this is what you had in mind, but I've attempted a split up here ( https://sourceware.org/pipermail/gdb-patches/2026-April/226731.html ). Thanks, - Tom > 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