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/python/py-param.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'gdb/python/py-param.c') diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c index 22b26b2..ef5c91b 100644 --- a/gdb/python/py-param.c +++ b/gdb/python/py-param.c @@ -401,15 +401,10 @@ get_set_value (const char *args, int from_tty, return; } } - else - { - /* We have to preserve the existing < GDB 7.3 API. If a - callback function does not exist, then attempt to read the - set_doc attribute. */ - set_doc_string = get_doc_string (obj, set_doc_cst); - } - fprintf_filtered (gdb_stdout, "%s\n", set_doc_string.get ()); + const char *str = set_doc_string.get (); + if (str != nullptr && str[0] != '\0') + fprintf_filtered (gdb_stdout, "%s\n", str); } /* A callback function that is registered against the respective -- cgit v1.1