From patchwork Wed Feb 15 21:58:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 65073 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 01D6B3858D33 for ; Wed, 15 Feb 2023 21:59:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 01D6B3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676498343; bh=NHD7xI4Rzotq+9hmAz5z0wCEKSpawDOsLXTvr8oQAww=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=sHZgSp8EPKNWnSyqscehpKH704X4ZrGsukHM4udPDhonSMpO8Nh3Hqrsq27neKYLt P5tHp9U04ygH6/bAkdC+5XsN3+6JiTp+LlkxHidxVxc6xPxiRwquFO/KL3qugE4A9t MQVYoKTRUd7CfXUHbmf4amN5Kx699GZNw0OXApkQ= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by sourceware.org (Postfix) with ESMTPS id 8B0753858D28 for ; Wed, 15 Feb 2023 21:58:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8B0753858D28 Received: by mail-io1-xd35.google.com with SMTP id bl9so7694828iob.7 for ; Wed, 15 Feb 2023 13:58:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NHD7xI4Rzotq+9hmAz5z0wCEKSpawDOsLXTvr8oQAww=; b=usVsFDXc0xNzp/s9cigb5K/tEHBpnMwYMB7y+QcI5vC7Z5tdX9wtPN5SGMSiKQ3nTJ j/DiZg4eTCF3Wvv0LpfjrvzmcKiO7ucb+ZZ15CexjNWJqmQsT2S1dydi/28FaDO4yv8q BZ3At3zj+Q3cyyN6T6r9WPu0136NLZhBpHMrHkGBSq0GxDuRTp3rht66Z+0+jUGjnmbo CPXAmdsVv6gXkDkVRNd9tXaCatkJGofCZxQLwoJZoDDRLdkxp+BRGyeM6DdQFfxhilwH DE1V3E+VJnqPDSFSd19cuE8dDXTZgnS6eS47W9GhHcd+FEzRUPWpzCeFogoM70orMLSf XDqQ== X-Gm-Message-State: AO0yUKWXSLJ8Jj8uqIinJfRhecxZG73MgNER6RFth50ZTmgHjlTn6xZ/ bz9DX6/qhkufS3xq9N3iRfFYG9cMe4ScAjWW X-Google-Smtp-Source: AK7set/JslUMGDTKxaGTZ5BV9myHO6RZdmfT3lMT+qsvWzLKCHdgOV0gYkwEn+W4UlFca5d6c4pqsw== X-Received: by 2002:a05:6602:380d:b0:723:8cb5:6704 with SMTP id bb13-20020a056602380d00b007238cb56704mr73930iob.3.1676498317795; Wed, 15 Feb 2023 13:58:37 -0800 (PST) Received: from localhost.localdomain (75-166-130-93.hlrn.qwest.net. [75.166.130.93]) by smtp.gmail.com with ESMTPSA id q4-20020a0566380ec400b003a9515b47ebsm3046jas.68.2023.02.15.13.58.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 13:58:37 -0800 (PST) To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Fix Tcl quoting in gdb_assert Date: Wed, 15 Feb 2023 14:58:28 -0700 Message-Id: <20230215215828.1337884-1-tromey@adacore.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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 Tromey via Gdb-patches From: Tom Tromey Reply-To: Tom Tromey Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" The gdb_assert proc under-quotes the expression that is passed in. This leads to weird code in a couple of spots that tries to compensate: gdb_assert {{$all_regs eq $completed_regs}} ... The fix is to add a bit of quoting when evaluating the expression. --- gdb/testsuite/gdb.base/completion.exp | 2 +- gdb/testsuite/gdb.base/step-over-no-symbols.exp | 6 +++--- gdb/testsuite/lib/gdb.exp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index 1533acbf4f9..4686e6f8f34 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -159,7 +159,7 @@ foreach {-> reg} [regexp -all -inline -line {^info registers (\w+\S*)} $regs_out lappend completed_regs $reg } set completed_regs [join [lsort $completed_regs]] -gdb_assert {{$all_regs eq $completed_regs}} "complete 'info registers '" +gdb_assert {$all_regs eq $completed_regs} "complete 'info registers '" # Tests below are about tab-completion, which doesn't work if readline # library isn't used. Check it first. diff --git a/gdb/testsuite/gdb.base/step-over-no-symbols.exp b/gdb/testsuite/gdb.base/step-over-no-symbols.exp index 00b32deacf7..1136b47571b 100644 --- a/gdb/testsuite/gdb.base/step-over-no-symbols.exp +++ b/gdb/testsuite/gdb.base/step-over-no-symbols.exp @@ -76,9 +76,9 @@ proc test_step_over { displaced } { set after_addr [get_pc "get after PC"] - gdb_assert {{[regexp "^${hex}$" $before_addr] \ - && [regexp "^${hex}$" $after_addr] \ - && $before_addr != $after_addr}} "advanced" + gdb_assert {[regexp "^${hex}$" $before_addr] \ + && [regexp "^${hex}$" $after_addr] \ + && $before_addr != $after_addr} "advanced" } foreach displaced { "off" "on" "auto" } { diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index e48228ed4f6..ecd6ca0a8ef 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1947,7 +1947,7 @@ proc gdb_assert { condition {message ""} } { set message $condition } - set code [catch {uplevel 1 expr $condition} res] + set code [catch {uplevel 1 [list expr $condition]} res] if {$code == 1} { # If code is 1 (TCL_ERROR), it means evaluation failed and res contains # an error message. Print the error message, and set res to 0 since we