From 984ee559a26e138d8bcc1f850c1cacb9eded2b1c Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 26 Apr 2018 16:51:40 -0600 Subject: Fix "set" handling of Python parameters It's long bothered me that setting a Python parameter from the CLI will print the "set" help text by default. I think usually "set" commands should be silent. And, while you can modify this behavior a bit by providing a "get_set_string" method, if this method returns an empty string, a blank line will be printed. This patch removes the "help" behavior and changes the get_set_string behavior to avoid printing a blank line. The code has a comment about preserving API behavior, but I don't think this is truly important; and in any case the workaround -- implementing get_set_string -- is trivial. Regression tested on x86-64 Fedora 26. 2018-04-26 Tom Tromey * NEWS: Mention new "set" behavior. * python/py-param.c (get_set_value): Don't print an empty string. Don't call get_doc_string. gdb/doc/ChangeLog 2018-04-26 Tom Tromey * python.texi (Parameters In Python): Update get_set_string documentation. --- gdb/testsuite/gdb.python/py-parameter.exp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdb/testsuite/gdb.python/py-parameter.exp') diff --git a/gdb/testsuite/gdb.python/py-parameter.exp b/gdb/testsuite/gdb.python/py-parameter.exp index 1ea79b8..0508544 100644 --- a/gdb/testsuite/gdb.python/py-parameter.exp +++ b/gdb/testsuite/gdb.python/py-parameter.exp @@ -151,7 +151,7 @@ gdb_py_test_multiple "Simple gdb booleanparameter" \ "end" gdb_test "show print test-nodoc-param" "This command is not documented.*" "show parameter on" -gdb_test "set print test-nodoc-param off" "This command is not documented.*" "turn off parameter" +gdb_test_no_output "set print test-nodoc-param off" "turn off parameter" gdb_test "show print test-nodoc-param" "This command is not documented.*.*" "show parameter off" gdb_test "python print (test_nodoc_param.value)" "False" "test parameter value" gdb_test "help show print test-nodoc-param" "This command is not documented.*" "test show help" @@ -173,7 +173,7 @@ gdb_py_test_multiple "Simple gdb booleanparameter" \ gdb_test "python print (test_param.value)" "True" "test parameter value" gdb_test "show print test-param" "State of the Test Parameter on.*" "show parameter on" -gdb_test "set print test-param off" "Set the state of the Test Parameter.*" "turn off parameter" +gdb_test_no_output "set print test-param off" "turn off parameter" gdb_test "show print test-param" "State of the Test Parameter off.*" "show parameter off" gdb_test "python print (test_param.value)" "False" "test parameter value" gdb_test "help show print test-param" "State of the Test Parameter.*" "test show help" -- cgit v1.1