From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id D9F91399E00D for ; Fri, 23 Jul 2021 19:42:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D9F91399E00D Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 16NJg6QK030261 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 23 Jul 2021 15:42:11 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 16NJg6QK030261 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 6AF9D1E813 for ; Fri, 23 Jul 2021 15:42:06 -0400 (EDT) Subject: Re: [PATCH 14/16] gdb/testsuite: test get/set value of unregistered Guile parameter To: gdb-patches@sourceware.org References: <20210714045520.1623120-1-simon.marchi@polymtl.ca> <20210714045520.1623120-15-simon.marchi@polymtl.ca> From: Simon Marchi Message-ID: Date: Fri, 23 Jul 2021 15:42:06 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210714045520.1623120-15-simon.marchi@polymtl.ca> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 23 Jul 2021 19:42:06 +0000 X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, 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: Fri, 23 Jul 2021 19:42:13 -0000 On 2021-07-14 12:55 a.m., Simon Marchi wrote: > 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. > > I pushed everything up to this point. Simon