From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id BB22F3972017 for ; Wed, 14 Jul 2021 04:57:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BB22F3972017 X-ASG-Debug-ID: 1626238642-0c856e67e219ef340001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id ZwVPhWfBODwFMFni (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 14 Jul 2021 00:57:22 -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 11623441D64; Wed, 14 Jul 2021 00:57:22 -0400 (EDT) From: Simon Marchi 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 14/16] gdb/testsuite: test get/set value of unregistered Guile parameter Date: Wed, 14 Jul 2021 00:55:18 -0400 X-ASG-Orig-Subj: [PATCH 14/16] gdb/testsuite: test get/set value of unregistered Guile parameter Message-Id: <20210714045520.1623120-15-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: 1626238642 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: 1700 X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.91193 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M X-Spam-Status: No, score=-16.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_QUARANTINE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Wed, 14 Jul 2021 04:57:25 -0000 When creating a parameter in Guile, you have to create it using make-parameter and then register it with GDB with register-parameter!. In between, it's still possible (though not documented) to set the parameter's value. I broke this use case by mistake while writing this series, so thought it would be good to have a test for it. I suppose that people could use this "feature" to give their parameter an initial value, even though make-parameter has an initial-value parameter for this. Nevertheless, changing this behavior could break some scripts, which is why I think it's important for it to be tested. Change-Id: I5b2103e3cec0cfdcccf7ffb00eb05fed8626e66d --- gdb/testsuite/gdb.guile/scm-parameter.exp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gdb/testsuite/gdb.guile/scm-parameter.exp b/gdb/testsuite/gdb.guile/scm-parameter.exp index 67120b233664..5a2fb42503d0 100644 --- a/gdb/testsuite/gdb.guile/scm-parameter.exp +++ b/gdb/testsuite/gdb.guile/scm-parameter.exp @@ -176,6 +176,14 @@ with_test_prefix "test-restricted-param" { gdb_test "guile (register-parameter! (make-parameter \"height\"))" \ "ERROR.*is already defined.*" "error registering existing parameter" +# Test printing and setting the value of an unregistered parameter. +gdb_test "guile (print (parameter-value (make-parameter \"foo\")))" \ + "= #f" +gdb_test "guile (define myparam (make-parameter \"foo\"))" +gdb_test_no_output "guile (set-parameter-value! myparam #t)" +gdb_test "guile (print (parameter-value myparam))" \ + "= #t" + # Test registering a parameter named with what was an ambiguous spelling # of existing parameters. -- 2.32.0