public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Remove "show" command completers, "set" command completers for string commands
@ 2019-06-12 23:28 Pedro Alves
  0 siblings, 0 replies; only message in thread
From: Pedro Alves @ 2019-06-12 23:28 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=597bf39df91c9a2e27cf1966dd4c942ac645ae33

commit 597bf39df91c9a2e27cf1966dd4c942ac645ae33
Author: Pedro Alves <palves@redhat.com>
Date:   Thu Jun 13 00:06:52 2019 +0100

    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:
    2019-06-13  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.

Diff:
---
 gdb/ChangeLog        |  7 +++++++
 gdb/cli/cli-decode.c | 14 +++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c254e36..f1354de 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
 2019-06-13  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.
+
+2019-06-13  Pedro Alves  <palves@redhat.com>
+
 	* cli/cli-setshow.c (do_set_command) <var_enum>: Detect junk
 	after item.
 
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index e59e0c7..30f79b5 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -509,6 +509,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;
@@ -633,11 +636,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
@@ -659,6 +667,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;
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-06-12 23:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-12 23:28 [binutils-gdb] Remove "show" command completers, "set" command completers for string commands Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).