From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-io1-xd35.google.com with SMTP id bl9so7694828iob.7 for ; Wed, 15 Feb 2023 13:58:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=NHD7xI4Rzotq+9hmAz5z0wCEKSpawDOsLXTvr8oQAww=; b=Svch+AuPQ9I8gprOTXBMIHbxDh6NBHaqO5nnlg3da/OR50A9DjqR12UW4LhQKqx9Jj XO1W6vwpQtvdw4iw8KJlIatvUGl8/1CuduwDKsIe8cq3imQ5GPLQxH7yRNR0g3ekreZW h965PfKkf8g54+JTl5rlxEG8JYS4e2wKElt38LzMqBA2JaqF0bWC/CT/ttSQPVGWw+Dt aUw12g1C95LstypTguy7uaw1bzN7IlkcW2AjEd+TeEaDqRumwqj7yx+3wukLv2vc9kCc EqslRtAU4L/xjV1jAU/p3MagTxlCEDLYiQV3QvIDpEZ43u9244w14vvqz9wIavWgbjpM boTg== 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) From: Tom Tromey 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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 -- 2.39.1