From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id y6ZyN1QrHmkutRQAWB0awg (envelope-from ) for ; Wed, 19 Nov 2025 15:40:52 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=NvrPcRZT; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id CE2071E0B6; Wed, 19 Nov 2025 15:40:52 -0500 (EST) 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 server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (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 385771E048 for ; Wed, 19 Nov 2025 15:40:52 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CAF12385275F for ; Wed, 19 Nov 2025 20:40:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CAF12385275F Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=NvrPcRZT Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 2049C385E839 for ; Wed, 19 Nov 2025 20:40:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2049C385E839 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2049C385E839 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763584821; cv=none; b=pvMSdR6qPgOUNj+OgOM299uOdYSKQi7r+OAEYdNz4301CPNONnFsnJM2a0T94sggU26OQARwt5DeygxUrHzsnTi7gv7ZRUsW7g8XztGLy2ioBUmi2GVGdCdT7Z2877xERCXtmqsjaujqUw9sT/znKdx7JtkzbsL5jF/3s9jKVSU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763584821; c=relaxed/simple; bh=vY2z6zCE7VilzGS+bQ4rhqj4KjPSJ7W3HyzMcAva9tc=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=xerNigqHXaWcxKNmY5AfuhN1gecApGQoOmlV3jJFTNtIscvgpkQJruz6+SdcgqnGZwCZXNa7YAbP26fReImoR/1Ho0OgmZWGvsKc6eKTg3po4PoorFbUjQndiTDzx0nC/LKY6MMpN+tHPHMSfRFygKLyJXzWhz6lzwKzGidO4vk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2049C385E839 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 5AJKeDmh141412 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Nov 2025 15:40:18 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 5AJKeDmh141412 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=oct2025; t=1763584818; bh=KtH9beRB8LLE3XBxtmdJi2zmE6OvNVvg4qIua+iwNUQ=; h=Date:Subject:To:Cc:From:In-Reply-To:From; b=NvrPcRZThpFVDH2lY0qoRm/42hOszy2hQh4KlbYYnJPyCTu1inPwQU9VK/HeyiMmB 7byr+DGgA1DUStcm8YlQAZSsUMi83dF5WMSwkNjIhmYSODJA/lmSnlXcM2n6yKSR+4 rziDqckJh5rVxyVy8gc+wPnu/qYH9bW7E20c/8iPRbn4ESE/JwFk+4f8Iw62EHWw38 1vwImpkwCtAoq8Tnavf+syDxPk3evrtn8Btwuf2mIhy8Gpl+85ZmJRuatHhrQtj8mb qjDAPmL0PmFWQgkcaBcfMQ7UC+J9f/aMFkqLUG8HnVnvDDV7XMwzDfgoN5j1czqCt5 Jx3X5YT/U9K+g== Received: by simark.ca (Postfix) id 6A1D41E048; Wed, 19 Nov 2025 15:40:13 -0500 (EST) Message-ID: <42a67fe2-718e-44e3-8a13-066205b2c3f4@polymtl.ca> Date: Wed, 19 Nov 2025 15:40:12 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/6] gdb/testsuite/dwarf: convert _section proc to use parse_options To: Tom Tromey , Simon Marchi Cc: gdb-patches@sourceware.org References: <20251107211041.520697-1-simon.marchi@efficios.com> <20251107211041.520697-3-simon.marchi@efficios.com> <87v7j6qari.fsf@tromey.com> Content-Language: en-US From: Simon Marchi In-Reply-To: <87v7j6qari.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 19 Nov 2025 20:40:13 +0000 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 2025-11-19 10:53, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > > I meant to send this last week but forgot. > > Simon> - proc _section {name {flags ""} {type ""}} { > Simon> - if {$name == ".debug_str"} { > Simon> - # Hard-code this because it's always desirable. > Simon> - _emit " .section $name, \"MS\", %progbits, 1" > Simon> - } elseif {$flags == "" && $type == ""} { > Simon> - _emit " .section $name" > Simon> - } elseif {$type == ""} { > Simon> - _emit " .section $name, \"$flags\"" > Simon> - } else { > Simon> - _emit " .section $name, \"$flags\", %$type" > > This code ignores flags and type if name is .debug_str, but the > replacement code: > > Simon> + if { $name == ".debug_str" } { > Simon> + # Hard-code this because it's always desirable. > Simon> + append directive ", \"MS\", %progbits, 1" > Simon> + } > Simon> + > Simon> + if { $flags != "" } { > Simon> + append directive ",\"$flags\"" > Simon> + } > Simon> + > Simon> + if { $type != "" } { > Simon> + # Can't specify a type without flags. > Simon> + if { $flags == "" } { > Simon> + append directive ", \"\"" > Simon> + } > Simon> + > Simon> + append directive ", %$type" > Simon> + } > > ... does not. > > I think the old code was clearer in this regard. I didn't read forward > in the series to see if this restructuring helps newer code though. > Anyway this change should be addressed. It's true that if one was to call the proc with $name == ".debug_str" and some flags, the resulting assembler directive would be malformed. I can change it to if { $name == ".debug_str" } { # Hard-code this because it's always desirable. _emit " .section .debug_str, \"MS\", %progbits, 1" return } I think that would make it clear again that this is a special case, disconnected from the rest. Or something cleaner would be to remove this bit from this proc, and add a _section_debug_str proc that would call _section with the right params (might need a _defer_output_debug_str as well). Simon