From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id OIJ+IawzK2hiOCoAWB0awg (envelope-from ) for ; Mon, 19 May 2025 09:35:40 -0400 Received: by simark.ca (Postfix, from userid 112) id 850FF1E11C; Mon, 19 May 2025 09:35:40 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-9.0 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE 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 2981C1E102 for ; Mon, 19 May 2025 09:35:40 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DDDFE385842D for ; Mon, 19 May 2025 13:35:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DDDFE385842D Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by sourceware.org (Postfix) with ESMTPS id 21CBA3857C6D for ; Mon, 19 May 2025 13:25:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 21CBA3857C6D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 21CBA3857C6D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1747661130; cv=none; b=AngS5x9Ga7+ytT+fQxX5v+2QFmzcMvrq26TfE6xZkM31EB4m4o1vNeSU37ckBuJbF6VN1FGSVUpG6uvQV7HENT97bN3GJJPpe7Cdp2kfeqeaScSQcJzahpShKZ0FIETVyH9u5drjqGPNFfK/E2zABapxa/JScdYDsHeljn7ntvU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1747661130; c=relaxed/simple; bh=F4EMw0r3JM/9E62dfAc93W6gAYztCcdtlNBqvNMrl1g=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=qFTj4lMQA1tiLsksay1NLcWre3EK+mKcmy26SVKyHeSPO56ndWhDA71v9hJpyShoKJPXT/xg1gDG8xP3p/yH0V9J0lVodSKN9J1uZEZ6gO4zHvpOj4bE+/kgusokYgP9mT8oNg8GDXp3YAQzb+M7Ac5w1C0iS2UITEGZomGuI9c= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 21CBA3857C6D Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-3a36ab95a13so914213f8f.3 for ; Mon, 19 May 2025 06:25:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747661129; x=1748265929; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z6LXRLUfo+GlZdTeCFQopwuxRqcAwNdbOqYZoFx4YT0=; b=DfeD5+e+NYkxKHnU/1wpHfxsy7VK+/OJWHmXjzh8wcA2iIOQuaENFgWBo4cNwCksnF jnF+diebd2kg68T0/TOw8+4aVFriXHB6KjPDWu6F1InryOREfa8yK6eHxOOrD1z61+E+ 1uNDQypEIfRl0IpWmOX4+YyZQmcrCTyid5Bst1Ab0cb2sGl5hBY7K5uyWc247nbJ761W rVf8dytNlmhUSd7ss63pDgXMHZjfSuH/rVGOAJ/fgBIXCdU7le5P7KBKhmewrPVYezRN MPZPVOQBEsA3q1XzAkpiQaAc6LnySVv8nK7bVBXILLNY0wTE7tcPPeD6pq7eBjD83Gcm HvEg== X-Gm-Message-State: AOJu0YxusPVLvR39tmG5oV9GZFJDYZnvKISHKVXD8Zhq2fpS23GTkGYf hqDK+jos+ZmxjS2EVnASTpFMhrWF2d5E0I0RRKvBLXQ98J2JZmclsmW8JRL1SoXI X-Gm-Gg: ASbGnctmKcjuiF0mEvemjtCF1ppA4ejet6lEQ3Nz4COPmzcORnxcSuyMCCvVxJ73j3H 9vxSP+MEsM8JD41ZzW5xDuSuepXr++J8InY7hBN6rxOSPYyWMrOFfIo2PNlZVJBSEGbCzA6bNax mtuwmsHbEffRlcIoUsULLjoDu6OvkdgC1fulhc1A0wbGtugkJFL83/tuDyJy7rYPC6SCfU453US qBjIolE63pHy7d+9XglBWUWDvIfC3jVb+shF7b0NsUZmjugW2llpwx6woAlk252a77SrAHtbUrF kW+dukAEJTBatjQoK7NV/hhMulWiuSg4mbI98muFOvHKCwXx17Y= X-Google-Smtp-Source: AGHT+IHJ6iWPm8ZVOj6KwMCZhGeiuXRN5L7d1ItgWhsQ9Fdg98DkVSpg47rdvRCpNv9XGAvw9S1d2Q== X-Received: by 2002:a05:6000:2407:b0:3a1:f564:cd9d with SMTP id ffacd0b85a97d-3a3600da1edmr10232738f8f.36.1747661128644; Mon, 19 May 2025 06:25:28 -0700 (PDT) Received: from localhost ([2001:8a0:4fe9:b400:8d90:6f0d:36bf:32df]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-3a35ca5bd7fsm13015296f8f.38.2025.05.19.06.25.27 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 May 2025 06:25:28 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 42/47] gdb_test_multiple: Anchor prompt match if -lbl Date: Mon, 19 May 2025 14:23:03 +0100 Message-ID: <20250519132308.3553663-43-pedro@palves.net> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250519132308.3553663-1-pedro@palves.net> References: <20250519132308.3553663-1-pedro@palves.net> 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 I wrote a test like this: gdb_test_multiple "command" "" -lbl { -re "^\r\nprefix foo(?=\r\n)" { exp_continue } -re "^\r\nprefix bar(?=\r\n)" { exp_continue } -re "^\r\prefix (?=\r\n)" { exp_continue } -re "^\r\n$::gdb_prompt $" { pass $gdb_test_name } } Anchors are needed in my case to avoid too-eager matching due to the common prefix. The intent is for the prompt match above to override the built-in prompt match. However, it doesn't and the test fails with output like this: (gdb) command prefix foo prefix bar meant-to-be-matched-by-lbl (gdb) That's because the built-in match for the prompt matches before the -lbl pattern for this expect buffer: \r\nmeant-to-be-matched-by-lbl\r\n(gdb) This this by anchoring the built-in prompt match if -lbl was requested. Change-Id: Ic2571ec793d856a89ee0d533ec363e2ac6036ea2 --- gdb/testsuite/lib/gdb.exp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index c51cea86a9d..6d64344bc0a 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1124,6 +1124,7 @@ proc gdb_test_multiple { command message args } { global any_spawn_id set line_by_line 0 + set lbl_anchor_re "" set prompt_regexp "" set prompt_anchor 1 for {set i 0} {$i < [llength $args]} {incr i} { @@ -1133,6 +1134,7 @@ proc gdb_test_multiple { command message args } { set prompt_regexp [lindex $args $i] } elseif { $arg == "-lbl" } { set line_by_line 1 + set lbl_anchor_re "^" } elseif { $arg == "-no-prompt-anchor" } { set prompt_anchor 0 } else { @@ -1391,7 +1393,7 @@ proc gdb_test_multiple { command message args } { fail "$errmsg" set result -1 } - -re "\r\n$prompt_regexp" { + -re "${lbl_anchor_re}\r\n$prompt_regexp" { if {![string match "" $message]} { fail "$message" } -- 2.49.0