From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id IKtpIE9u7mCsIgAAWB0awg (envelope-from ) for ; Wed, 14 Jul 2021 00:55:43 -0400 Received: by simark.ca (Postfix, from userid 112) id 82D031EDEE; Wed, 14 Jul 2021 00:55:43 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from 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 RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id BFFE71E54D for ; Wed, 14 Jul 2021 00:55:42 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 467F7385C417 for ; Wed, 14 Jul 2021 04:55:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 467F7385C417 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1626238542; bh=U0DR/zmP5z5YNRW0JV16jPgt5UrWf7eSQYHtyoc5Zao=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=auRWq6ih7MrlFKPi4Cr33trscbkVqoHS9E1mEfXzKf8cerv48sResUTlTAxgU1sPH 1nspVgZmbC3nMfqV9jRH9sZgdZwsCQiaJzfGb7JDJH0TJzzPHSFnY3NybjVuI3iPIb +F+HISZ/Z/xatWyfdDdkbxHT9h2xNmdgyloS+MB0= Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id A8ADD3857827 for ; Wed, 14 Jul 2021 04:55:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A8ADD3857827 X-ASG-Debug-ID: 1626238521-0c856e6cd51c9e4c0001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id 1VceFeQCAnPW6Lqx (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 14 Jul 2021 00:55:21 -0400 (EDT) X-Barracuda-Envelope-From: simon.marchi@polymtl.ca X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from simark.localdomain (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) by smtp.ebox.ca (Postfix) with ESMTP id 293FE441D65; Wed, 14 Jul 2021 00:55:21 -0400 (EDT) X-Barracuda-RBL-IP: 192.222.157.6 X-Barracuda-Effective-Source-IP: 192-222-157-6.qc.cable.ebox.net[192.222.157.6] X-Barracuda-Apparent-Source-IP: 192.222.157.6 To: gdb-patches@sourceware.org Subject: [PATCH 02/16] gdb.base/setshow.exp: use save_vars to save/restore gdb_prompt Date: Wed, 14 Jul 2021 00:55:06 -0400 X-ASG-Orig-Subj: [PATCH 02/16] gdb.base/setshow.exp: use save_vars to save/restore gdb_prompt Message-Id: <20210714045520.1623120-3-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210714045520.1623120-1-simon.marchi@polymtl.ca> References: <20210714045520.1623120-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1626238521 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-BRTS-Status: 1 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 2474 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.91193 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 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: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Using save_vars is a bit better than what we have now, as it ensures the variable gets restored if the code within it throws an error. Change-Id: I3bd6836e5b7efb61b078acadff1a1c8182c19a27 --- gdb/testsuite/gdb.base/setshow.exp | 33 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/gdb/testsuite/gdb.base/setshow.exp b/gdb/testsuite/gdb.base/setshow.exp index 5404b5239671..7b273b3902a5 100644 --- a/gdb/testsuite/gdb.base/setshow.exp +++ b/gdb/testsuite/gdb.base/setshow.exp @@ -48,31 +48,30 @@ gdb_test "show annotate" "Annotation_level is 0..*" "default annotation_level i #test set annotate 2 # Here we need to fiddle with prompts. -set old_gdb_prompt $gdb_prompt -set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n" +save_vars { gdb_prompt } { + set old_gdb_prompt $gdb_prompt + set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n" -gdb_test_multiple "set annotate 2" "set annotate 2" { - -re "\r\n$gdb_prompt$" { - pass "set annotate 2" + gdb_test_multiple "set annotate 2" "set annotate 2" { + -re "\r\n$gdb_prompt$" { + pass "set annotate 2" + } } -} -gdb_test_multiple "show annotate" "show annotate 2" { - -re ".*\032\032post-prompt.*Annotation_level is 2..*\032\032pre-prompt.*$old_gdb_prompt .*\032\032prompt.*$" { - pass "show annotate 2" + gdb_test_multiple "show annotate" "show annotate 2" { + -re ".*\032\032post-prompt.*Annotation_level is 2..*\032\032pre-prompt.*$old_gdb_prompt .*\032\032prompt.*$" { + pass "show annotate 2" + } } -} -#test annotation_level 2 -gdb_test_multiple "info line 1" "annotation_level 2" { - -re ".*\032\032post-prompt.*Line 1 of .* is at address .* but contains no code.*:1:0:beg:0x.*\032\032pre-prompt.*$old_gdb_prompt .*\032\032prompt.*$" { - pass "annotation_level 2" + #test annotation_level 2 + gdb_test_multiple "info line 1" "annotation_level 2" { + -re ".*\032\032post-prompt.*Line 1 of .* is at address .* but contains no code.*:1:0:beg:0x.*\032\032pre-prompt.*$old_gdb_prompt .*\032\032prompt.*$" { + pass "annotation_level 2" + } } } -# Restore the original prompt for the rest of the testsuite. -set gdb_prompt $old_gdb_prompt - #test set annotate 1 gdb_test "set annotate 1" ".*post-prompt.*" gdb_test "show annotate" "Annotation_level is 1..*" "show annotate (1)" -- 2.32.0