From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id EfGWEopgDmm6TSoAWB0awg (envelope-from ) for ; Fri, 07 Nov 2025 16:11:38 -0500 Received: by simark.ca (Postfix, from userid 112) id 488DF1E0BC; Fri, 07 Nov 2025 16:11:38 -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.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, 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 95E621E04C for ; Fri, 07 Nov 2025 16:11:37 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 345423858C2C for ; Fri, 7 Nov 2025 21:11:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 345423858C2C Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 9AB153858D1E for ; Fri, 7 Nov 2025 21:10:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9AB153858D1E Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9AB153858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1762549843; cv=none; b=jjiRkhyl/PyTj29nZ8QA4IZ/SVypxPmkL/lh899bD5Gc9TVrlEOJSYWXrn/tgJxoCJsjrUuRDGTEt0pXcjihfB7DHs+RWnBBRTVd0v645Kjv+cH1T9gfJSUn79EpTwAgh2cXwAqbWALJBu5QpkIAlYGWpj0GrdD5vyrDTT80/Tk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1762549843; c=relaxed/simple; bh=iX04kV5F5EOrDC+gd+3cqZdxQ5BpQzqnRhSkydszGDE=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=oXZvWz5YliqKjZUNn1iN54A/vgqvvkWErfB8ecBFgFihAulrZxkniy8AW6hCqMM691dYI1AGWsnt6hhm7f6HMD+LhntCdup2dtib+rC9uGWWCQbOELI8BcXRT1y4tm198e66Mpv2GpiRhBrzoh/HiXAgzE1AQvGhPUgJuNeNZxU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9AB153858D1E Received: by simark.ca (Postfix) id 02B7B1E0BC; Fri, 07 Nov 2025 16:10:42 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 2/6] gdb/testsuite/dwarf: convert _section proc to use parse_options Date: Fri, 7 Nov 2025 16:10:13 -0500 Message-ID: <20251107211041.520697-3-simon.marchi@efficios.com> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251107211041.520697-1-simon.marchi@efficios.com> References: <20251107211041.520697-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From: Simon Marchi The following patch will add more options to the _section proc, so convert it to use options, to be more user-friendly. Change-Id: I971e4e10e55d63af2a5e29dc5e1d00f368b3ecaa --- gdb/testsuite/lib/dwarf.exp | 45 +++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp index 919e2e05687f..5536b7656b8c 100644 --- a/gdb/testsuite/lib/dwarf.exp +++ b/gdb/testsuite/lib/dwarf.exp @@ -1071,17 +1071,33 @@ namespace eval Dwarf { } } - proc _section {name {flags ""} {type ""}} { - if {$name == ".debug_str"} { - # Hard-code this because it's always desirable. - _emit " .section $name, \"MS\", %progbits, 1" - } elseif {$flags == "" && $type == ""} { - _emit " .section $name" - } elseif {$type == ""} { - _emit " .section $name, \"$flags\"" - } else { - _emit " .section $name, \"$flags\", %$type" + proc _section {name {options {}}} { + parse_options { + { flags "" } + { type "" } } + + set directive ".section $name" + + if { $name == ".debug_str" } { + # Hard-code this because it's always desirable. + append directive ", \"MS\", %progbits, 1" + } + + if { $flags != "" } { + append directive ",\"$flags\"" + } + + if { $type != "" } { + # Can't specify a type without flags. + if { $flags == "" } { + append directive ", \"\"" + } + + append directive ", %$type" + } + + _emit " $directive" } # SECTION_SPEC is a list of arguments to _section. @@ -3173,7 +3189,10 @@ namespace eval Dwarf { # Emit a note section holding the given build-id. proc build_id {buildid} { - _defer_output {.note.gnu.build-id a note} { + _defer_output {.note.gnu.build-id { + flags a + type note + }} { # From elf/common.h. set NT_GNU_BUILD_ID 3 @@ -3607,7 +3626,9 @@ namespace eval Dwarf { _write_deferred_output - _section .note.GNU-stack "" progbits + _section .note.GNU-stack { + type progbits + } if { $file_id == "" } { catch {close $_output_file} -- 2.51.2