From patchwork Sat Dec 29 15:51:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Waroquiers X-Patchwork-Id: 30898 Received: (qmail 123441 invoked by alias); 29 Dec 2018 15:51:28 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 123429 invoked by uid 89); 29 Dec 2018 15:51:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-27.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=history, HContent-Transfer-Encoding:8bit X-HELO: mailsec110.isp.belgacom.be Received: from mailsec110.isp.belgacom.be (HELO mailsec110.isp.belgacom.be) (195.238.20.106) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 29 Dec 2018 15:51:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1546098685; x=1577634685; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=OyHMSDE4Zzy6RQip8cIhC582+adZEyk/1bkXgVOK3hM=; b=CXUOUoepcpy1AVH09HAJn8vJGbD4OruFhZsKOy+8lrzefXdcgAaDGvrh i1D9IS0OpJtk6jM6eKp6E7oM6uQluA==; Received: from 184.205-67-87.adsl-dyn.isp.belgacom.be (HELO md.home) ([87.67.205.184]) by relay.skynet.be with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 29 Dec 2018 16:51:22 +0100 From: Philippe Waroquiers To: gdb-patches@sourceware.org Cc: Philippe Waroquiers Subject: [RFA] Fix 'help set/show style' strange layouts/results. Date: Sat, 29 Dec 2018 16:51:16 +0100 Message-Id: <20181229155116.6603-1-philippe.waroquiers@skynet.be> MIME-Version: 1.0 X-IsSubscribed: yes The layout for 'help set address|variable' is strange, e.g.: (gdb) help set style address style address List of show Address display styling Configure address colors and display intensity subcommands: show Address display styling Configure address colors and display intensity background -- Set the background color for this property show Address display styling Configure address colors and display intensity foreground -- Set the foreground color for this property show Address display styling Configure address colors and display intensity intensity -- Set the display intensity color for this property Type "help show Address display styling Configure address colors and display intensity" followed by show Address display styling Configure address colors and display intensity subcommand name for full documentation. Type "apropos word" to search for commands related to "word". Command name abbreviations are allowed if unambiguous. (gdb) The help for 'set style function|filename' gives help for 'Show': (gdb) help set style filename Filename display styling Configure filename colors and display intensity. List of show style filename subcommands: show style filename background -- Set the background color for this property show style filename foreground -- Set the foreground color for this property show style filename intensity -- Set the display intensity color for this property The help for 'show style function|filename' is equally strange, as it speaks about commands, instead of sub commands: (gdb) help show style filename Filename display styling Configure filename colors and display intensity. List of commands: background -- Show the background color for this property foreground -- Show the foreground color for this property intensity -- Show the display intensity color for this property Type "help" followed by command name for full documentation. Type "apropos word" to search for commands related to "word". Command name abbreviations are allowed if unambiguous. (gdb) This patch fixes all this. Note that the 'set style' and 'show style' have the same prefix_doc: (gdb) help show style Style-specific settings Configure various style-related variables, such as colors ... (gdb) help set style Style-specific settings Configure various style-related variables, such as colors ... Other similar commands (such as set|show history) have typically a more specific prefix: (gdb) help show history Generic command for showing command history parameters. ... (gdb) help set history Generic command for setting command history parameters. ... This could be fixed by having set_prefix_doc and show_prefix_doc instead of the single prefix_doc argument to cli_style_option::add_setshow_commands. That could be improved if deemed better. 2018-12-29 Philippe Waroquiers * cli/cli-style.c (cli_style_option::add_setshow_commands): Initialize m_set_prefix with "set", instead of re-assigning m_show_prefix. Use m_set_prefix for set_list and m_show_prefix for show_list. (_initialize_cli_style): Correct the order of arguments in variable_name_style.add_setshow_commands and address_style.add_setshow_commands calls. --- gdb/cli/cli-style.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gdb/cli/cli-style.c b/gdb/cli/cli-style.c index 0308e1ccfc..13f02579bc 100644 --- a/gdb/cli/cli-style.c +++ b/gdb/cli/cli-style.c @@ -172,13 +172,13 @@ cli_style_option::add_setshow_commands (const char *name, struct cmd_list_element **set_list, struct cmd_list_element **show_list) { - m_show_prefix = std::string ("set ") + prefixname + " "; + m_set_prefix = std::string ("set ") + prefixname + " "; m_show_prefix = std::string ("show ") + prefixname + " "; add_prefix_cmd (name, no_class, do_set, prefix_doc, &m_set_list, - m_show_prefix.c_str (), 0, set_list); + m_set_prefix.c_str (), 0, set_list); add_prefix_cmd (name, no_class, do_show, prefix_doc, &m_show_list, - m_set_prefix.c_str (), 0, show_list); + m_show_prefix.c_str (), 0, show_list); add_setshow_enum_cmd ("foreground", theclass, cli_colors, &m_foreground, @@ -270,17 +270,17 @@ Configure function name colors and display intensity"), &style_set_list, &style_show_list); variable_name_style.add_setshow_commands ("variable", no_class, - "style variable", _("\ Variable name display styling\n\ Configure variable name colors and display intensity"), + "style variable", &style_set_list, &style_show_list); address_style.add_setshow_commands ("address", no_class, - "style address", _("\ Address display styling\n\ Configure address colors and display intensity"), + "style address", &style_set_list, &style_show_list); }