[PATCH v2 3/4] "maint test-settings set/show" -> "maint set/show test-settings"

Pedro Alves
2019-06-18T00:39:11Z

This commit renames "maint test-settings set/show" to "maint set/show
test-settings".

This helps the following patch, which introduce a "maint with" command
what works with all "maint set" settings.

gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <palves@redhat.com>

* NEWS (New commands): Mention "maint set/show test-settings"
instead of "maint test-settings".
* maint-test-settings.c (maintenance_test_settings_list): Delete.
(maintenance_test_settings_set_list): Rename to ...
(maintenance_set_test_settings_list): ... this.
(maintenance_test_settings_show_list): Rename to ...
(maintenance_show_test_settings_list): ... this.
(maintenance_test_settings_cmd): Delete.
(maintenance_test_settings_set_cmd): ...
(maintenance_set_test_settings_cmd): ... this.
(maintenance_test_settings_show_cmd): ...
(maintenance_show_test_settings_cmd): ... this.
(maintenance_test_settings_show_value_cmd):
(maintenance_show_test_settings_value_cmd): ... this.
(_initialize_maint_test_settings): No longer install the "maint
test-settings" prefix command. Rename "maint test-settings set"
to "maint set test-settings", and "maint test-settings show" to
"maint show test-settings". Adjust all subcommands.

gdb/doc/ChangeLog:
yyyy-mm-dd Pedro Alves <palves@redhat.com>

* gdb.texinfo (Maintenance Commands): Document "maint set/show
test-settings" instead of "maint test-settings set/show".

gdb/testsuite/ChangeLog:
yyyy-mm-dd Pedro Alves <palves@redhat.com>

* gdb.base/settings.exp: Replace all references to "maint
test-settings set" with references to "maint set test-settings",
and all references to "maint test-settings show" with references
to "maint show test-settings".
---
gdb/doc/gdb.texinfo | 7 +-
gdb/NEWS | 3 +-
gdb/maint-test-settings.c | 149 ++++++++++++++++--------------------
gdb/testsuite/gdb.base/settings.exp | 26 +++----
4 files changed, 83 insertions(+), 102 deletions(-)

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 9a0320e5d8f..a279a145502 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -37626,9 +37626,10 @@ Shows the result of completing the @code{maint test-options}
subcommands. This is used by the testsuite to validate completion
support in the command options framework.

-@kindex maint test-settings
-@item maint test-settings set @var{kind}
-@itemx maint test-settings show @var{kind}
+@kindex maint set test-settings
+@kindex maint show test-settings
+@item maint set test-settings @var{kind}
+@itemx maint show test-settings @var{kind}
These are representative commands for each @var{kind} of setting type
@value{GDBN} supports. They are used by the testsuite for exercising
the settings infrastructure.
diff --git a/gdb/NEWS b/gdb/NEWS
index 62521ed75a1..4a7a117970a 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -84,7 +84,8 @@ set style highlight background COLOR
set style highlight intensity VALUE
Control the styling of highlightings.

-maint test-settings KIND
+maint set test-settings KIND
+maint show test-settings KIND
A set of commands used by the testsuite for exercising the settings
infrastructure.

diff --git a/gdb/maint-test-settings.c b/gdb/maint-test-settings.c
index 5075ed1aac0..b549b8d39bf 100644
--- a/gdb/maint-test-settings.c
+++ b/gdb/maint-test-settings.c
@@ -21,46 +21,33 @@
#include "defs.h"
#include "gdbcmd.h"

-/* Command list for "maint test-settings". */
-static cmd_list_element *maintenance_test_settings_list;
+/* Command list for "maint set test-settings". */
+static cmd_list_element *maintenance_set_test_settings_list;

-/* Command list for "maint test-settings set/show". */
-static cmd_list_element *maintenance_test_settings_set_list;
-static cmd_list_element *maintenance_test_settings_show_list;
+/* Command list for "maint show test-settings". */
+static cmd_list_element *maintenance_show_test_settings_list;

-/* The "maintenance test-settings" prefix command. */
+/* The "maintenance set test-settings" prefix command. */

static void
-maintenance_test_settings_cmd (const char *arg, int from_tty)
+maintenance_set_test_settings_cmd (const char *args, int from_tty)
{
- printf_unfiltered
- (_("\"maintenance test-settings\" must be followed "
- "by the name of a subcommand.\n"));
- help_list (maintenance_test_settings_list, "maintenance test-settings ",
- all_commands, gdb_stdout);
-}
-
-/* The "maintenance test-settings set" prefix command. */
-
-static void
-maintenance_test_settings_set_cmd (const char *args, int from_tty)
-{
- printf_unfiltered (_("\"maintenance test-settings set\" must be followed "
+ printf_unfiltered (_("\"maintenance set test-settings\" must be followed "
"by the name of a set command.\n"));
- help_list (maintenance_test_settings_set_list,
- "maintenance test-settings set ",
+ help_list (maintenance_set_test_settings_list,
+ "maintenance set test-settings ",
all_commands, gdb_stdout);
}

-/* The "maintenance test-settings show" prefix command. */
+/* The "maintenance show test-settings" prefix command. */

static void
-maintenance_test_settings_show_cmd (const char *args, int from_tty)
+maintenance_show_test_settings_cmd (const char *args, int from_tty)
{
- cmd_show_list (maintenance_test_settings_show_list, from_tty, "");
+ cmd_show_list (maintenance_show_test_settings_list, from_tty, "");
}

-/* Control variables for all the "maintenance test-settings set/show
+/* Control variables for all the "maintenance set/show test-settings
xxx" commands. */

static int maintenance_test_settings_boolean;
@@ -85,7 +72,7 @@ static char *maintenance_test_settings_optional_filename;

static char *maintenance_test_settings_filename;

-/* Enum values for the "maintenance test-settings set/show boolean"
+/* Enum values for the "maintenance set/show test-settings boolean"
commands. */
static const char maintenance_test_settings_xxx[] = "xxx";
static const char maintenance_test_settings_yyy[] = "yyy";
@@ -101,10 +88,10 @@ static const char *const maintenance_test_settings_enums[] = {
static const char *maintenance_test_settings_enum
= maintenance_test_settings_xxx;

-/* The "maintenance test-settings show xxx" commands. */
+/* The "maintenance show test-settings xxx" commands. */

static void
-maintenance_test_settings_show_value_cmd
+maintenance_show_test_settings_value_cmd
(struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
@@ -117,29 +104,21 @@ _initialize_maint_test_settings (void)
{
maintenance_test_settings_filename = xstrdup ("/foo/bar");

- add_prefix_cmd ("test-settings", no_class,
- maintenance_test_settings_cmd,
- _("\
-Generic command for testing the settings infrastructure."),
- &maintenance_test_settings_list,
- "maintenance test-settings ", 0,
- &maintenancelist);
-
- add_prefix_cmd ("set", class_maintenance,
- maintenance_test_settings_set_cmd, _("\
+ add_prefix_cmd ("test-settings", class_maintenance,
+ maintenance_set_test_settings_cmd, _("\
Set GDB internal variables used for set/show command infrastructure testing."),
- &maintenance_test_settings_set_list,
- "maintenance test-settings set ",
+ &maintenance_set_test_settings_list,
+ "maintenance set test-settings ",
0/*allow-unknown*/,
- &maintenance_test_settings_list);
+ &maintenance_set_cmdlist);

- add_prefix_cmd ("show", class_maintenance,
- maintenance_test_settings_show_cmd, _("\
+ add_prefix_cmd ("test-settings", class_maintenance,
+ maintenance_show_test_settings_cmd, _("\
Show GDB internal variables used for set/show command infrastructure testing."),
- &maintenance_test_settings_show_list,
- "maintenance test-settings show ",
+ &maintenance_show_test_settings_list,
+ "maintenance show test-settings ",
0/*allow-unknown*/,
- &maintenance_test_settings_list);
+ &maintenance_show_cmdlist);

add_setshow_boolean_cmd ("boolean", class_maintenance,
&maintenance_test_settings_boolean, _("\
@@ -147,9 +126,9 @@ command used for internal testing"), _("\
command used for internal testing"),
nullptr, /* help_doc */
nullptr, /* set_cmd */
- maintenance_test_settings_show_value_cmd,
- &maintenance_test_settings_set_list,
- &maintenance_test_settings_show_list);
+ maintenance_show_test_settings_value_cmd,
+ &maintenance_set_test_settings_list,
+ &maintenance_show_test_settings_list);

add_setshow_auto_boolean_cmd ("auto-boolean", class_maintenance,
&maintenance_test_settings_auto_boolean, _("\
@@ -157,19 +136,19 @@ command used for internal testing"), _("\
command used for internal testing"),
nullptr, /* help_doc */
nullptr, /* set_cmd */
- maintenance_test_settings_show_value_cmd,
- &maintenance_test_settings_set_list,
- &maintenance_test_settings_show_list);
+ maintenance_show_test_settings_value_cmd,
+ &maintenance_set_test_settings_list,
+ &maintenance_show_test_settings_list);

add_setshow_uinteger_cmd ("uinteger", class_maintenance,
&maintenance_test_settings_uinteger, _("\
command used for internal testing"), _("\
command used for internal testing"),
- nullptr, /* help_doc */
- nullptr, /* set_cmd */
- maintenance_test_settings_show_value_cmd,
- &maintenance_test_settings_set_list,
- &maintenance_test_settings_show_list);
+ nullptr, /* help_doc */
+ nullptr, /* set_cmd */
+ maintenance_show_test_settings_value_cmd,
+ &maintenance_set_test_settings_list,
+ &maintenance_show_test_settings_list);

add_setshow_integer_cmd ("integer", class_maintenance,
&maintenance_test_settings_integer, _("\
@@ -177,9 +156,9 @@ command used for internal testing"), _("\
command used for internal testing"),
nullptr, /* help_doc */
nullptr, /* set_cmd */
- maintenance_test_settings_show_value_cmd,
- &maintenance_test_settings_set_list,
- &maintenance_test_settings_show_list);
+ maintenance_show_test_settings_value_cmd,
+ &maintenance_set_test_settings_list,
+ &maintenance_show_test_settings_list);

add_setshow_string_cmd ("string", class_maintenance,
&maintenance_test_settings_string, _("\
@@ -187,9 +166,9 @@ command used for internal testing"), _("\
command used for internal testing"),
nullptr, /* help_doc */
nullptr, /* set_cmd */
- maintenance_test_settings_show_value_cmd,
- &maintenance_test_settings_set_list,
- &maintenance_test_settings_show_list);
+ maintenance_show_test_settings_value_cmd,
+ &maintenance_set_test_settings_list,
+ &maintenance_show_test_settings_list);

add_setshow_string_noescape_cmd
("string-noescape", class_maintenance,
@@ -198,9 +177,9 @@ command used for internal testing"), _("\
command used for internal testing"),
nullptr, /* help_doc */
nullptr, /* set_cmd */
- maintenance_test_settings_show_value_cmd,
- &maintenance_test_settings_set_list,
- &maintenance_test_settings_show_list);
+ maintenance_show_test_settings_value_cmd,
+ &maintenance_set_test_settings_list,
+ &maintenance_show_test_settings_list);

add_setshow_optional_filename_cmd
("optional-filename", class_maintenance,
@@ -209,9 +188,9 @@ command used for internal testing"), _("\
command used for internal testing"),
nullptr, /* help_doc */
nullptr, /* set_cmd */
- maintenance_test_settings_show_value_cmd,
- &maintenance_test_settings_set_list,
- &maintenance_test_settings_show_list);
+ maintenance_show_test_settings_value_cmd,
+ &maintenance_set_test_settings_list,
+ &maintenance_show_test_settings_list);

add_setshow_filename_cmd ("filename", class_maintenance,
&maintenance_test_settings_filename, _("\
@@ -219,9 +198,9 @@ command used for internal testing"), _("\
command used for internal testing"),
nullptr, /* help_doc */
nullptr, /* set_cmd */
- maintenance_test_settings_show_value_cmd,
- &maintenance_test_settings_set_list,
- &maintenance_test_settings_show_list);
+ maintenance_show_test_settings_value_cmd,
+ &maintenance_set_test_settings_list,
+ &maintenance_show_test_settings_list);

add_setshow_zinteger_cmd ("zinteger", class_maintenance,
&maintenance_test_settings_zinteger, _("\
@@ -229,9 +208,9 @@ command used for internal testing"), _("\
command used for internal testing"),
nullptr, /* help_doc */
nullptr, /* set_cmd */
- maintenance_test_settings_show_value_cmd,
- &maintenance_test_settings_set_list,
- &maintenance_test_settings_show_list);
+ maintenance_show_test_settings_value_cmd,
+ &maintenance_set_test_settings_list,
+ &maintenance_show_test_settings_list);

add_setshow_zuinteger_cmd ("zuinteger", class_maintenance,
&maintenance_test_settings_zuinteger, _("\
@@ -239,9 +218,9 @@ command used for internal testing"), _("\
command used for internal testing"),
nullptr, /* help_doc */
nullptr, /* set_cmd */
- maintenance_test_settings_show_value_cmd,
- &maintenance_test_settings_set_list,
- &maintenance_test_settings_show_list);
+ maintenance_show_test_settings_value_cmd,
+ &maintenance_set_test_settings_list,
+ &maintenance_show_test_settings_list);

add_setshow_zuinteger_unlimited_cmd
("zuinteger-unlimited", class_maintenance,
@@ -250,9 +229,9 @@ command used for internal testing"), _("\
command used for internal testing"),
nullptr, /* help_doc */
nullptr, /* set_cmd */
- maintenance_test_settings_show_value_cmd,
- &maintenance_test_settings_set_list,
- &maintenance_test_settings_show_list);
+ maintenance_show_test_settings_value_cmd,
+ &maintenance_set_test_settings_list,
+ &maintenance_show_test_settings_list);

add_setshow_enum_cmd ("enum", class_maintenance,
maintenance_test_settings_enums,
@@ -261,7 +240,7 @@ command used for internal testing"), _("\
command used for internal testing"),
nullptr, /* help_doc */
nullptr, /* set_cmd */
- maintenance_test_settings_show_value_cmd,
- &maintenance_test_settings_set_list,
- &maintenance_test_settings_show_list);
+ maintenance_show_test_settings_value_cmd,
+ &maintenance_set_test_settings_list,
+ &maintenance_show_test_settings_list);
}
diff --git a/gdb/testsuite/gdb.base/settings.exp b/gdb/testsuite/gdb.base/settings.exp
index b691ad8cf68..53049d6b592 100644
--- a/gdb/testsuite/gdb.base/settings.exp
+++ b/gdb/testsuite/gdb.base/settings.exp
@@ -45,8 +45,8 @@ proc show_setting {show_cmd expected_re} {
# var_Xinteger tests. VARIANT determines which command/variant to
# exercise.
proc test-integer {variant} {
- set set_cmd "maint test-settings set $variant"
- set show_cmd "maint test-settings show $variant"
+ set set_cmd "maint set test-settings $variant"
+ set show_cmd "maint show test-settings $variant"

# A bogus value.
gdb_test "$set_cmd bogus" \
@@ -122,7 +122,7 @@ proc test-integer {variant} {
}

if {$variant == "zuinteger"} {
- test_gdb_complete_multiple "maint test-settings set " "zuinteger" "" {
+ test_gdb_complete_multiple "maint set test-settings " "zuinteger" "" {
"zuinteger"
"zuinteger-unlimited"
}
@@ -166,7 +166,7 @@ proc test-integer {variant} {

# Check show command completion.
if {$variant == "zuinteger"} {
- test_gdb_complete_multiple "maintenance test-settings show " "zuinteger" "" {
+ test_gdb_complete_multiple "maintenance show test-settings " "zuinteger" "" {
"zuinteger"
"zuinteger-unlimited"
}
@@ -182,8 +182,8 @@ proc test-integer {variant} {
proc_with_prefix test-boolean {} {
# Use these variables to make sure we don't call the wrong command
# by mistake.
- set set_cmd "maint test-settings set boolean"
- set show_cmd "maint test-settings show boolean"
+ set set_cmd "maint set test-settings boolean"
+ set show_cmd "maint show test-settings boolean"

# A bogus value.
gdb_test "$set_cmd bogus" \
@@ -277,8 +277,8 @@ proc_with_prefix test-boolean {} {
proc_with_prefix test-auto-boolean {} {
# Use these variables to make sure we don't call the wrong command
# by mistake.
- set set_cmd "maint test-settings set auto-boolean"
- set show_cmd "maint test-settings show auto-boolean"
+ set set_cmd "maint set test-settings auto-boolean"
+ set show_cmd "maint show test-settings auto-boolean"

# A bogus value.
gdb_test "$set_cmd bogus" \
@@ -381,8 +381,8 @@ proc_with_prefix test-auto-boolean {} {
proc_with_prefix test-enum {} {
# Use these variables to make sure we don't call the wrong command
# by mistake.
- set set_cmd "maint test-settings set enum"
- set show_cmd "maint test-settings show enum"
+ set set_cmd "maint set test-settings enum"
+ set show_cmd "maint show test-settings enum"

# Missing value.
gdb_test "$set_cmd" \
@@ -444,8 +444,8 @@ proc test-string {variant} {

# Use these variables to make sure we don't call the wrong command
# by mistake.
- set set_cmd "maint test-settings set $variant"
- set show_cmd "maint test-settings show $variant"
+ set set_cmd "maint set test-settings $variant"
+ set show_cmd "maint show test-settings $variant"

# Checks that gdb doesn't crash if we haven't set the string yet.
if {$variant != "filename"} {
@@ -519,7 +519,7 @@ proc test-string {variant} {

# Check show command completion.
if {$variant == "string"} {
- test_gdb_complete_multiple "maint test-settings show " "string" "" {
+ test_gdb_complete_multiple "maint show test-settings " "string" "" {
"string"
"string-noescape"
}
--
2.14.5