From patchwork Fri Mar 24 09:46:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 66839 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 097A43870894 for ; Fri, 24 Mar 2023 09:46:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 097A43870894 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679651196; bh=uqgp2zdFikZhbWZgjGSxifWsjs0g2D70h87IQCNcXrQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=E9FMzLRwZEFoBwePfpMmgUxUyuBd/SFwAp0Ns6INIs00kmLE3Z70JslEU1foBINPa iyuPl/1IG9Ig2r4ZOw5GiKi5G4ex9pWXE9dXPxOOlDvMEui4U+FGwMUz5IENruUb6v oH2eyqUNngajHflRN5ywPIFvFVjqJwE8bjsJcD5M= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id EB4C238708C9 for ; Fri, 24 Mar 2023 09:46:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EB4C238708C9 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D06EF1FE6B for ; Fri, 24 Mar 2023 09:46:11 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id BC6FD138ED for ; Fri, 24 Mar 2023 09:46:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id nlTCLGNxHWSuKQAAMHmgww (envelope-from ) for ; Fri, 24 Mar 2023 09:46:11 +0000 To: gdb-patches@sourceware.org Subject: [pushed] [gdb/testsuite] Fix unbalanced quotes in mi_expect_stop argument Date: Fri, 24 Mar 2023 10:46:10 +0100 Message-Id: <20230324094610.28590-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" In proc mi_expect_stop there's a proc argument reason that's handled like so: ... set r "reason=\"$reason\"," ... That's fine for say: ... set reason "foo" ... for which this evaluates to: ... set r "reason=\"foo\"," ... But there are more complex uses, for instance: ... set reason "breakpoint-hit\",disp=\"keep\",bkptno=\"$decimal" ... which evaluates to: ... set r "\"breakpoint-hit\",disp=\"keep\",bkptno=\"$decimal\"" ... Note how in this reason argument, the first two '\"' seems to form a pair surrounding ',disp=', which is not the case, which is confusing. Fix this by only adding the quotes in mi_expect_stop if the string doesn't already contain quotes, such that we have the more readable: ... set reason "\"breakpoint-hit\",disp=\"keep\",bkptno=\"$decimal\"" ... Tested on x86_64-linux. --- gdb/testsuite/gdb.ada/mi_catch_assert.exp | 2 +- gdb/testsuite/gdb.ada/mi_catch_ex.exp | 8 ++++---- gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp | 4 ++-- gdb/testsuite/gdb.ada/mi_ex_cond.exp | 2 +- gdb/testsuite/lib/mi-support.exp | 6 +++++- 5 files changed, 13 insertions(+), 9 deletions(-) base-commit: 1985d8cb7048bcfce60b59cfe219d3b09bda6373 diff --git a/gdb/testsuite/gdb.ada/mi_catch_assert.exp b/gdb/testsuite/gdb.ada/mi_catch_assert.exp index e0d5439dc26..c3673fab8e8 100644 --- a/gdb/testsuite/gdb.ada/mi_catch_assert.exp +++ b/gdb/testsuite/gdb.ada/mi_catch_assert.exp @@ -79,7 +79,7 @@ mi_gdb_test "-catch-assert -c \"Global_Var = 2\"" \ set bp_location [gdb_get_line_number "STOP" ${testdir}/bla.adb] mi_execute_to "exec-continue" \ - "breakpoint-hit\",disp=\"keep\",bkptno=\"$decimal" \ + "\"breakpoint-hit\",disp=\"keep\",bkptno=\"$decimal\"" \ "bla" "" ".*" "$bp_location" \ ".*" \ "continue to assert failure catchpoint hit" diff --git a/gdb/testsuite/gdb.ada/mi_catch_ex.exp b/gdb/testsuite/gdb.ada/mi_catch_ex.exp index 6a0f94a5f87..d0dfbd59764 100644 --- a/gdb/testsuite/gdb.ada/mi_catch_ex.exp +++ b/gdb/testsuite/gdb.ada/mi_catch_ex.exp @@ -92,7 +92,7 @@ proc continue_to_exception { exception_name exception_message test } { # Now MI stream output. mi_expect_stop \ - "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"$exception_name\(\",exception-message=\"$exception_message\)?" \ + "\"breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"$exception_name\(\",exception-message=\"$exception_message\)?\"" \ "foo" "" ".*" ".*" \ ".*" \ $test @@ -140,19 +140,19 @@ mi_gdb_test "-catch-exception -u" \ "catch unhandled exceptions" mi_execute_to "exec-continue" \ - "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"PROGRAM_ERROR(\",exception-message=\"foo\\.adb:$decimal explicit raise)?" \ + "\"breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"PROGRAM_ERROR(\",exception-message=\"foo\\.adb:$decimal explicit raise)?\"" \ "foo" "" ".*" ".*" \ ".*" \ "continue to exception catchpoint hit" mi_execute_to "exec-continue" \ - "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb" \ + "\"breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\"" \ "foo" "" ".*" ".*" \ ".*" \ "continue to assert failure catchpoint hit" mi_execute_to "exec-continue" \ - "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"CONSTRAINT_ERROR" \ + "\"breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"CONSTRAINT_ERROR\"" \ "foo" "" ".*" ".*" \ ".*" \ "continue to unhandled exception catchpoint hit" diff --git a/gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp b/gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp index 82c7b2a300a..2cd175f098b 100644 --- a/gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp +++ b/gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp @@ -82,7 +82,7 @@ proc continue_to_exception_handler { test line } { # Now MI stream output. mi_expect_stop \ - "breakpoint-hit\",disp=\"keep\",bkptno=\"$decimal\",exception-name=\"exception\"?" \ + "\"breakpoint-hit\",disp=\"keep\",bkptno=\"$decimal\",exception-name=\"exception\"" \ "foo" "" ".*" "$line" \ ".*" \ $test @@ -125,7 +125,7 @@ mi_gdb_test "-catch-handlers -e Constraint_Error" \ "catch Constraint_Error" mi_execute_to "exec-continue" \ - "breakpoint-hit\",disp=\"keep\",bkptno=\"$decimal\",exception-name=\"exception\"?" \ + "\"breakpoint-hit\",disp=\"keep\",bkptno=\"$decimal\",exception-name=\"exception\"" \ "foo" "" ".*" "$bp_ce_location" \ ".*" \ "continue to exception catchpoint hit" diff --git a/gdb/testsuite/gdb.ada/mi_ex_cond.exp b/gdb/testsuite/gdb.ada/mi_ex_cond.exp index f41b633a822..54aa6b54ee1 100644 --- a/gdb/testsuite/gdb.ada/mi_ex_cond.exp +++ b/gdb/testsuite/gdb.ada/mi_ex_cond.exp @@ -77,7 +77,7 @@ mi_gdb_test "-catch-exception -c \"i = 2\" -e constraint_error" \ mi_run_cmd mi_expect_stop \ - "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"CONSTRAINT_ERROR(\",exception-message=\"foo\\.adb:$decimal explicit raise)?" \ + "\"breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"CONSTRAINT_ERROR(\",exception-message=\"foo\\.adb:$decimal explicit raise)?\"" \ "foo" "" ".*" ".*" \ ".*" \ "run to exception catchpoint hit" diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index 3c2dd2fab2b..c738b7be505 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -1267,7 +1267,11 @@ proc mi_expect_stop { reason func args file line extra test } { set r "" if { $reason != "" } { - set r "reason=\"$reason\"," + if { [regexp {"} $reason] } { + set r "reason=$reason," + } else { + set r "reason=\"$reason\"," + } }