[07/24] Remove "show" command completers

Message ID 20190522205327.2568-8-palves@redhat.com
State New
Headers show
Series
  • gdb::option framework, "print -OPT", other cmd options
Related show

Commit Message

Pedro Alves May 22, 2019, 8:53 p.m.
The default command completer is symbol_completer, but it makes no
sense for a "show" command to complete on symbols, or anything else,
really.

I wonder whether we should instead make the default be no completer.
That seems like a much larger/complicated audit/change, so I'd like to
move forward with this version, as it'll be covered by tests.  I
noticed this because a following patch will add a new
gdb.base/settings.exp testcase that exercises all sorts of details of
settings commands, including completing the show commands, using new
representative "maint test-settings <type or settings command>"
commands.

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

	* cli/cli-decode.c (add_setshow_enum_cmd)
	(add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd)
	(add_setshow_filename_cmd, add_setshow_string_cmd)
	(add_setshow_string_noescape_cmd)
	(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
	(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
	(add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd):
	Remove "show" completer.
---
 gdb/cli/cli-decode.c | 74 ++++++++++++++++++++++++++++++++++++----------------
 1 file changed, 52 insertions(+), 22 deletions(-)

-- 
2.14.5

Comments

Sergio Durigan Junior May 23, 2019, 7:28 p.m. | #1
On Wednesday, May 22 2019, Pedro Alves wrote:

> The default command completer is symbol_completer, but it makes no

> sense for a "show" command to complete on symbols, or anything else,

> really.


Agreed.

> I wonder whether we should instead make the default be no completer.

> That seems like a much larger/complicated audit/change, so I'd like to

> move forward with this version, as it'll be covered by tests.  I

> noticed this because a following patch will add a new

> gdb.base/settings.exp testcase that exercises all sorts of details of

> settings commands, including completing the show commands, using new

> representative "maint test-settings <type or settings command>"

> commands.


I'm wondering why you chose to remove call set_cmd_completer on all of
the add_setshow_* functions if you could actually have called it once on
add_setshow_cmd_full, which is a static function and just used on
cli-decode.c anyway.

Otherwise, LGTM.

> gdb/ChangeLog:

> yyyy-mm-dd  Pedro Alves  <palves@redhat.com>

>

> 	* cli/cli-decode.c (add_setshow_enum_cmd)

> 	(add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd)

> 	(add_setshow_filename_cmd, add_setshow_string_cmd)

> 	(add_setshow_string_noescape_cmd)

> 	(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)

> 	(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)

> 	(add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd):

> 	Remove "show" completer.

> ---

>  gdb/cli/cli-decode.c | 74 ++++++++++++++++++++++++++++++++++++----------------

>  1 file changed, 52 insertions(+), 22 deletions(-)

>

> diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c

> index 72e2a970097..0eae0dc0005 100644

> --- a/gdb/cli/cli-decode.c

> +++ b/gdb/cli/cli-decode.c

> @@ -545,6 +545,8 @@ add_setshow_enum_cmd (const char *name,

>  

>    set_cmd_context (c, context);

>    set_cmd_context (show, context);

> +

> +  set_cmd_completer (show, nullptr);

>  }

>  

>  const char * const auto_boolean_enums[] = { "on", "off", "auto", NULL };

> @@ -564,14 +566,16 @@ add_setshow_auto_boolean_cmd (const char *name,

>  			      struct cmd_list_element **set_list,

>  			      struct cmd_list_element **show_list)

>  {

> -  struct cmd_list_element *c;

> +  cmd_list_element *set, *show;

>  

>    add_setshow_cmd_full (name, theclass, var_auto_boolean, var,

>  			set_doc, show_doc, help_doc,

>  			set_func, show_func,

>  			set_list, show_list,

> -			&c, NULL);

> -  c->enums = auto_boolean_enums;

> +			&set, &show);

> +  set->enums = auto_boolean_enums;

> +

> +  set_cmd_completer (show, nullptr);

>  }

>  

>  /* Add element named NAME to both the set and show command LISTs (the

> @@ -588,14 +592,16 @@ add_setshow_boolean_cmd (const char *name, enum command_class theclass, int *var

>  			 struct cmd_list_element **show_list)

>  {

>    static const char *boolean_enums[] = { "on", "off", NULL };

> -  struct cmd_list_element *c;

> +  cmd_list_element *set, *show;

>  

>    add_setshow_cmd_full (name, theclass, var_boolean, var,

>  			set_doc, show_doc, help_doc,

>  			set_func, show_func,

>  			set_list, show_list,

> -			&c, NULL);

> -  c->enums = boolean_enums;

> +			&set, &show);

> +  set->enums = boolean_enums;

> +

> +  set_cmd_completer (show, nullptr);

>  }

>  

>  /* Add element named NAME to both the set and show command LISTs (the

> @@ -610,14 +616,16 @@ add_setshow_filename_cmd (const char *name, enum command_class theclass,

>  			  struct cmd_list_element **set_list,

>  			  struct cmd_list_element **show_list)

>  {

> -  struct cmd_list_element *set_result;

> +  struct cmd_list_element *set_result, *show_result;

>  

>    add_setshow_cmd_full (name, theclass, var_filename, var,

>  			set_doc, show_doc, help_doc,

>  			set_func, show_func,

>  			set_list, show_list,

> -			&set_result, NULL);

> +			&set_result, &show_result);

>    set_cmd_completer (set_result, filename_completer);

> +

> +  set_cmd_completer (show_result, nullptr);

>  }

>  

>  /* Add element named NAME to both the set and show command LISTs (the

> @@ -632,11 +640,17 @@ add_setshow_string_cmd (const char *name, enum command_class theclass,

>  			struct cmd_list_element **set_list,

>  			struct cmd_list_element **show_list)

>  {

> +  cmd_list_element *set_cmd, *show_cmd;

> +

>    add_setshow_cmd_full (name, theclass, var_string, var,

>  			set_doc, show_doc, help_doc,

>  			set_func, show_func,

>  			set_list, show_list,

> -			NULL, NULL);

> +			&set_cmd, &show_cmd);

> +

> +  /* Disable the default symbol completer.  */

> +  set_cmd_completer (set_cmd, nullptr);

> +  set_cmd_completer (show_cmd, nullptr);

>  }

>  

>  /* Add element named NAME to both the set and show command LISTs (the

> @@ -651,13 +665,18 @@ add_setshow_string_noescape_cmd (const char *name, enum command_class theclass,

>  				 struct cmd_list_element **set_list,

>  				 struct cmd_list_element **show_list)

>  {

> -  struct cmd_list_element *set_cmd;

> +  cmd_list_element *set_cmd, *show_cmd;

>  

>    add_setshow_cmd_full (name, theclass, var_string_noescape, var,

>  			set_doc, show_doc, help_doc,

>  			set_func, show_func,

>  			set_list, show_list,

> -			&set_cmd, NULL);

> +			&set_cmd, &show_cmd);

> +

> +  /* Disable the default symbol completer.  */

> +  set_cmd_completer (set_cmd, nullptr);

> +  set_cmd_completer (show_cmd, nullptr);

> +

>    return set_cmd;

>  }

>  

> @@ -673,16 +692,16 @@ add_setshow_optional_filename_cmd (const char *name, enum command_class theclass

>  				   struct cmd_list_element **set_list,

>  				   struct cmd_list_element **show_list)

>  {

> -  struct cmd_list_element *set_result;

> +  cmd_list_element *set_result, *show_result;

>   

>    add_setshow_cmd_full (name, theclass, var_optional_filename, var,

>  			set_doc, show_doc, help_doc,

>  			set_func, show_func,

>  			set_list, show_list,

> -			&set_result, NULL);

> +			&set_result, &show_result);

>  		

>    set_cmd_completer (set_result, filename_completer);

> -

> +  set_cmd_completer (show_result, nullptr);

>  }

>  

>  /* Completes on literal "unlimited".  Used by integer commands that

> @@ -717,15 +736,16 @@ add_setshow_integer_cmd (const char *name, enum command_class theclass,

>  			 struct cmd_list_element **set_list,

>  			 struct cmd_list_element **show_list)

>  {

> -  struct cmd_list_element *set;

> +  cmd_list_element *set, *show;

>  

>    add_setshow_cmd_full (name, theclass, var_integer, var,

>  			set_doc, show_doc, help_doc,

>  			set_func, show_func,

>  			set_list, show_list,

> -			&set, NULL);

> +			&set, &show);

>  

>    set_cmd_completer (set, integer_unlimited_completer);

> +  set_cmd_completer (show, nullptr);

>  }

>  

>  /* Add element named NAME to both the set and show command LISTs (the

> @@ -742,15 +762,16 @@ add_setshow_uinteger_cmd (const char *name, enum command_class theclass,

>  			  struct cmd_list_element **set_list,

>  			  struct cmd_list_element **show_list)

>  {

> -  struct cmd_list_element *set;

> +  cmd_list_element *set, *show;

>  

>    add_setshow_cmd_full (name, theclass, var_uinteger, var,

>  			set_doc, show_doc, help_doc,

>  			set_func, show_func,

>  			set_list, show_list,

> -			&set, NULL);

> +			&set, &show);

>  

>    set_cmd_completer (set, integer_unlimited_completer);

> +  set_cmd_completer (show, nullptr);

>  }

>  

>  /* Add element named NAME to both the set and show command LISTs (the

> @@ -767,11 +788,15 @@ add_setshow_zinteger_cmd (const char *name, enum command_class theclass,

>  			  struct cmd_list_element **set_list,

>  			  struct cmd_list_element **show_list)

>  {

> +  cmd_list_element *show;

> +

>    add_setshow_cmd_full (name, theclass, var_zinteger, var,

>  			set_doc, show_doc, help_doc,

>  			set_func, show_func,

>  			set_list, show_list,

> -			NULL, NULL);

> +			NULL, &show);

> +

> +  set_cmd_completer (show, nullptr);

>  }

>  

>  void

> @@ -786,15 +811,16 @@ add_setshow_zuinteger_unlimited_cmd (const char *name,

>  				     struct cmd_list_element **set_list,

>  				     struct cmd_list_element **show_list)

>  {

> -  struct cmd_list_element *set;

> +  cmd_list_element *set, *show;

>  

>    add_setshow_cmd_full (name, theclass, var_zuinteger_unlimited, var,

>  			set_doc, show_doc, help_doc,

>  			set_func, show_func,

>  			set_list, show_list,

> -			&set, NULL);

> +			&set, &show);

>  

>    set_cmd_completer (set, integer_unlimited_completer);

> +  set_cmd_completer (show, nullptr);

>  }

>  

>  /* Add element named NAME to both the set and show command LISTs (the

> @@ -811,11 +837,15 @@ add_setshow_zuinteger_cmd (const char *name, enum command_class theclass,

>  			   struct cmd_list_element **set_list,

>  			   struct cmd_list_element **show_list)

>  {

> +  cmd_list_element *show;

> +

>    add_setshow_cmd_full (name, theclass, var_zuinteger, var,

>  			set_doc, show_doc, help_doc,

>  			set_func, show_func,

>  			set_list, show_list,

> -			NULL, NULL);

> +			NULL, &show);

> +

> +  set_cmd_completer (show, nullptr);

>  }

>  

>  /* Remove the command named NAME from the command list.  Return the

> -- 

> 2.14.5


-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/
Pedro Alves May 24, 2019, 11:25 a.m. | #2
On 5/23/19 8:28 PM, Sergio Durigan Junior wrote:
> On Wednesday, May 22 2019, Pedro Alves wrote:

> 

>> The default command completer is symbol_completer, but it makes no

>> sense for a "show" command to complete on symbols, or anything else,

>> really.

> 

> Agreed.

> 

>> I wonder whether we should instead make the default be no completer.

>> That seems like a much larger/complicated audit/change, so I'd like to

>> move forward with this version, as it'll be covered by tests.  I

>> noticed this because a following patch will add a new

>> gdb.base/settings.exp testcase that exercises all sorts of details of

>> settings commands, including completing the show commands, using new

>> representative "maint test-settings <type or settings command>"

>> commands.

> 

> I'm wondering why you chose to remove call set_cmd_completer on all of

> the add_setshow_* functions if you could actually have called it once on

> add_setshow_cmd_full, which is a static function and just used on

> cli-decode.c anyway.


Wow, how did I miss that?  Much simpler, thanks!

Now that I do this, it stands out what made me look at this code
originally (which I had forgotten).

It's that the var_string "set" commands complete on symbols, but
that doesn't make much sense; that's what I first noticed when I
was writing the gdb.base/settings.exp testcase.  When I fixed that,
while looking at the code, I realized that the "show" commands shouldn't
also complete on anything.  And then just copied over the same code to all
set/show commands, failing to notice that I could do it in
add_setshow_cmd_full.

Here's the updated patch.

From f4ba132856c870156d145d556c6e77d4cafb60a9 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>

Date: Wed, 22 May 2019 18:52:35 +0100
Subject: [PATCH 07/24] Remove "show" command completers, "set" command completers
 for string commands

The default command completer is symbol_completer, but it makes no
sense for a "show" command to complete on symbols, or anything else,
really.

I wonder whether we should instead make the default be no completer.
That seems like a much larger/complicated audit/change, so I'd like to
move forward with this version, as it'll be covered by tests.  I
noticed this because a following patch will add a new
gdb.base/settings.exp testcase that exercises all sorts of details of
settings commands, including completing the show commands, using new
representative "maint test-settings <type or settings command>"
commands.

Also remove the completer for var_string and var_string_noescape
commands.  No point in completing symbols when GDB is expecting a
string.

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

	* cli/cli-decode.c (add_setshow_cmd_full): Remove "show"
	completer.
	(add_setshow_string_cmd, add_setshow_string_noescape_cmd): Remove
	"set" completers.
---
 gdb/cli/cli-decode.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 72e2a970097..80158593b38 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -508,6 +508,9 @@ add_setshow_cmd_full (const char *name,
 			      full_show_doc, show_list);
   show->doc_allocated = 1;
   show->show_value_func = show_func;
+  /* Disable the default symbol completer.  Doesn't make much sense
+     for the "show" command to complete on anything.  */
+  set_cmd_completer (show, nullptr);
 
   if (set_result != NULL)
     *set_result = set;
@@ -632,11 +635,16 @@ add_setshow_string_cmd (const char *name, enum command_class theclass,
 			struct cmd_list_element **set_list,
 			struct cmd_list_element **show_list)
 {
+  cmd_list_element *set_cmd;
+
   add_setshow_cmd_full (name, theclass, var_string, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
-			NULL, NULL);
+			&set_cmd, NULL);
+
+  /* Disable the default symbol completer.  */
+  set_cmd_completer (set_cmd, nullptr);
 }
 
 /* Add element named NAME to both the set and show command LISTs (the
@@ -658,6 +666,10 @@ add_setshow_string_noescape_cmd (const char *name, enum command_class theclass,
 			set_func, show_func,
 			set_list, show_list,
 			&set_cmd, NULL);
+
+  /* Disable the default symbol completer.  */
+  set_cmd_completer (set_cmd, nullptr);
+
   return set_cmd;
 }
 
-- 
2.14.5
Sergio Durigan Junior May 24, 2019, 2:21 p.m. | #3
On Friday, May 24 2019, Pedro Alves wrote:

> On 5/23/19 8:28 PM, Sergio Durigan Junior wrote:

>> On Wednesday, May 22 2019, Pedro Alves wrote:

>> 

>>> The default command completer is symbol_completer, but it makes no

>>> sense for a "show" command to complete on symbols, or anything else,

>>> really.

>> 

>> Agreed.

>> 

>>> I wonder whether we should instead make the default be no completer.

>>> That seems like a much larger/complicated audit/change, so I'd like to

>>> move forward with this version, as it'll be covered by tests.  I

>>> noticed this because a following patch will add a new

>>> gdb.base/settings.exp testcase that exercises all sorts of details of

>>> settings commands, including completing the show commands, using new

>>> representative "maint test-settings <type or settings command>"

>>> commands.

>> 

>> I'm wondering why you chose to remove call set_cmd_completer on all of

>> the add_setshow_* functions if you could actually have called it once on

>> add_setshow_cmd_full, which is a static function and just used on

>> cli-decode.c anyway.

>

> Wow, how did I miss that?  Much simpler, thanks!

>

> Now that I do this, it stands out what made me look at this code

> originally (which I had forgotten).

>

> It's that the var_string "set" commands complete on symbols, but

> that doesn't make much sense; that's what I first noticed when I

> was writing the gdb.base/settings.exp testcase.  When I fixed that,

> while looking at the code, I realized that the "show" commands shouldn't

> also complete on anything.  And then just copied over the same code to all

> set/show commands, failing to notice that I could do it in

> add_setshow_cmd_full.


Yeah, I noticed you were also setting the completer for some of the
"set" commands as NULL as well :-).

> Here's the updated patch.


Much better, thanks!

FWIW, I'm still reviewing the other patches in the series.  Will let you
know when I have more comments.

> From f4ba132856c870156d145d556c6e77d4cafb60a9 Mon Sep 17 00:00:00 2001

> From: Pedro Alves <palves@redhat.com>

> Date: Wed, 22 May 2019 18:52:35 +0100

> Subject: [PATCH 07/24] Remove "show" command completers, "set" command completers

>  for string commands

>

> The default command completer is symbol_completer, but it makes no

> sense for a "show" command to complete on symbols, or anything else,

> really.

>

> I wonder whether we should instead make the default be no completer.

> That seems like a much larger/complicated audit/change, so I'd like to

> move forward with this version, as it'll be covered by tests.  I

> noticed this because a following patch will add a new

> gdb.base/settings.exp testcase that exercises all sorts of details of

> settings commands, including completing the show commands, using new

> representative "maint test-settings <type or settings command>"

> commands.

>

> Also remove the completer for var_string and var_string_noescape

> commands.  No point in completing symbols when GDB is expecting a

> string.

>

> gdb/ChangeLog:

> yyyy-mm-dd  Pedro Alves  <palves@redhat.com>

>

> 	* cli/cli-decode.c (add_setshow_cmd_full): Remove "show"

> 	completer.

> 	(add_setshow_string_cmd, add_setshow_string_noescape_cmd): Remove

> 	"set" completers.

> ---

>  gdb/cli/cli-decode.c | 14 +++++++++++++-

>  1 file changed, 13 insertions(+), 1 deletion(-)

>

> diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c

> index 72e2a970097..80158593b38 100644

> --- a/gdb/cli/cli-decode.c

> +++ b/gdb/cli/cli-decode.c

> @@ -508,6 +508,9 @@ add_setshow_cmd_full (const char *name,

>  			      full_show_doc, show_list);

>    show->doc_allocated = 1;

>    show->show_value_func = show_func;

> +  /* Disable the default symbol completer.  Doesn't make much sense

> +     for the "show" command to complete on anything.  */

> +  set_cmd_completer (show, nullptr);

>  

>    if (set_result != NULL)

>      *set_result = set;

> @@ -632,11 +635,16 @@ add_setshow_string_cmd (const char *name, enum command_class theclass,

>  			struct cmd_list_element **set_list,

>  			struct cmd_list_element **show_list)

>  {

> +  cmd_list_element *set_cmd;

> +

>    add_setshow_cmd_full (name, theclass, var_string, var,

>  			set_doc, show_doc, help_doc,

>  			set_func, show_func,

>  			set_list, show_list,

> -			NULL, NULL);

> +			&set_cmd, NULL);

> +

> +  /* Disable the default symbol completer.  */

> +  set_cmd_completer (set_cmd, nullptr);

>  }

>  

>  /* Add element named NAME to both the set and show command LISTs (the

> @@ -658,6 +666,10 @@ add_setshow_string_noescape_cmd (const char *name, enum command_class theclass,

>  			set_func, show_func,

>  			set_list, show_list,

>  			&set_cmd, NULL);

> +

> +  /* Disable the default symbol completer.  */

> +  set_cmd_completer (set_cmd, nullptr);

> +

>    return set_cmd;

>  }

>  

> -- 

> 2.14.5


-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

Patch

diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 72e2a970097..0eae0dc0005 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -545,6 +545,8 @@  add_setshow_enum_cmd (const char *name,
 
   set_cmd_context (c, context);
   set_cmd_context (show, context);
+
+  set_cmd_completer (show, nullptr);
 }
 
 const char * const auto_boolean_enums[] = { "on", "off", "auto", NULL };
@@ -564,14 +566,16 @@  add_setshow_auto_boolean_cmd (const char *name,
 			      struct cmd_list_element **set_list,
 			      struct cmd_list_element **show_list)
 {
-  struct cmd_list_element *c;
+  cmd_list_element *set, *show;
 
   add_setshow_cmd_full (name, theclass, var_auto_boolean, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
-			&c, NULL);
-  c->enums = auto_boolean_enums;
+			&set, &show);
+  set->enums = auto_boolean_enums;
+
+  set_cmd_completer (show, nullptr);
 }
 
 /* Add element named NAME to both the set and show command LISTs (the
@@ -588,14 +592,16 @@  add_setshow_boolean_cmd (const char *name, enum command_class theclass, int *var
 			 struct cmd_list_element **show_list)
 {
   static const char *boolean_enums[] = { "on", "off", NULL };
-  struct cmd_list_element *c;
+  cmd_list_element *set, *show;
 
   add_setshow_cmd_full (name, theclass, var_boolean, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
-			&c, NULL);
-  c->enums = boolean_enums;
+			&set, &show);
+  set->enums = boolean_enums;
+
+  set_cmd_completer (show, nullptr);
 }
 
 /* Add element named NAME to both the set and show command LISTs (the
@@ -610,14 +616,16 @@  add_setshow_filename_cmd (const char *name, enum command_class theclass,
 			  struct cmd_list_element **set_list,
 			  struct cmd_list_element **show_list)
 {
-  struct cmd_list_element *set_result;
+  struct cmd_list_element *set_result, *show_result;
 
   add_setshow_cmd_full (name, theclass, var_filename, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
-			&set_result, NULL);
+			&set_result, &show_result);
   set_cmd_completer (set_result, filename_completer);
+
+  set_cmd_completer (show_result, nullptr);
 }
 
 /* Add element named NAME to both the set and show command LISTs (the
@@ -632,11 +640,17 @@  add_setshow_string_cmd (const char *name, enum command_class theclass,
 			struct cmd_list_element **set_list,
 			struct cmd_list_element **show_list)
 {
+  cmd_list_element *set_cmd, *show_cmd;
+
   add_setshow_cmd_full (name, theclass, var_string, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
-			NULL, NULL);
+			&set_cmd, &show_cmd);
+
+  /* Disable the default symbol completer.  */
+  set_cmd_completer (set_cmd, nullptr);
+  set_cmd_completer (show_cmd, nullptr);
 }
 
 /* Add element named NAME to both the set and show command LISTs (the
@@ -651,13 +665,18 @@  add_setshow_string_noescape_cmd (const char *name, enum command_class theclass,
 				 struct cmd_list_element **set_list,
 				 struct cmd_list_element **show_list)
 {
-  struct cmd_list_element *set_cmd;
+  cmd_list_element *set_cmd, *show_cmd;
 
   add_setshow_cmd_full (name, theclass, var_string_noescape, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
-			&set_cmd, NULL);
+			&set_cmd, &show_cmd);
+
+  /* Disable the default symbol completer.  */
+  set_cmd_completer (set_cmd, nullptr);
+  set_cmd_completer (show_cmd, nullptr);
+
   return set_cmd;
 }
 
@@ -673,16 +692,16 @@  add_setshow_optional_filename_cmd (const char *name, enum command_class theclass
 				   struct cmd_list_element **set_list,
 				   struct cmd_list_element **show_list)
 {
-  struct cmd_list_element *set_result;
+  cmd_list_element *set_result, *show_result;
  
   add_setshow_cmd_full (name, theclass, var_optional_filename, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
-			&set_result, NULL);
+			&set_result, &show_result);
 		
   set_cmd_completer (set_result, filename_completer);
-
+  set_cmd_completer (show_result, nullptr);
 }
 
 /* Completes on literal "unlimited".  Used by integer commands that
@@ -717,15 +736,16 @@  add_setshow_integer_cmd (const char *name, enum command_class theclass,
 			 struct cmd_list_element **set_list,
 			 struct cmd_list_element **show_list)
 {
-  struct cmd_list_element *set;
+  cmd_list_element *set, *show;
 
   add_setshow_cmd_full (name, theclass, var_integer, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
-			&set, NULL);
+			&set, &show);
 
   set_cmd_completer (set, integer_unlimited_completer);
+  set_cmd_completer (show, nullptr);
 }
 
 /* Add element named NAME to both the set and show command LISTs (the
@@ -742,15 +762,16 @@  add_setshow_uinteger_cmd (const char *name, enum command_class theclass,
 			  struct cmd_list_element **set_list,
 			  struct cmd_list_element **show_list)
 {
-  struct cmd_list_element *set;
+  cmd_list_element *set, *show;
 
   add_setshow_cmd_full (name, theclass, var_uinteger, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
-			&set, NULL);
+			&set, &show);
 
   set_cmd_completer (set, integer_unlimited_completer);
+  set_cmd_completer (show, nullptr);
 }
 
 /* Add element named NAME to both the set and show command LISTs (the
@@ -767,11 +788,15 @@  add_setshow_zinteger_cmd (const char *name, enum command_class theclass,
 			  struct cmd_list_element **set_list,
 			  struct cmd_list_element **show_list)
 {
+  cmd_list_element *show;
+
   add_setshow_cmd_full (name, theclass, var_zinteger, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
-			NULL, NULL);
+			NULL, &show);
+
+  set_cmd_completer (show, nullptr);
 }
 
 void
@@ -786,15 +811,16 @@  add_setshow_zuinteger_unlimited_cmd (const char *name,
 				     struct cmd_list_element **set_list,
 				     struct cmd_list_element **show_list)
 {
-  struct cmd_list_element *set;
+  cmd_list_element *set, *show;
 
   add_setshow_cmd_full (name, theclass, var_zuinteger_unlimited, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
-			&set, NULL);
+			&set, &show);
 
   set_cmd_completer (set, integer_unlimited_completer);
+  set_cmd_completer (show, nullptr);
 }
 
 /* Add element named NAME to both the set and show command LISTs (the
@@ -811,11 +837,15 @@  add_setshow_zuinteger_cmd (const char *name, enum command_class theclass,
 			   struct cmd_list_element **set_list,
 			   struct cmd_list_element **show_list)
 {
+  cmd_list_element *show;
+
   add_setshow_cmd_full (name, theclass, var_zuinteger, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
-			NULL, NULL);
+			NULL, &show);
+
+  set_cmd_completer (show, nullptr);
 }
 
 /* Remove the command named NAME from the command list.  Return the