From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 07/24] Remove "show" command completers
Date: Wed, 22 May 2019 20:53:00 -0000 [thread overview]
Message-ID: <20190522205327.2568-8-palves@redhat.com> (raw)
In-Reply-To: <20190522205327.2568-1-palves@redhat.com>
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(-)
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
next prev parent reply other threads:[~2019-05-22 20:53 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-22 20:53 [PATCH 00/24] gdb::option framework, "print -OPT", other cmd options Pedro Alves
2019-05-22 20:53 ` [PATCH 18/24] lib/completion-support.exp: Add test_gdb_completion_offers_commands Pedro Alves
2019-05-22 20:53 ` [PATCH 04/24] Make check_for_argument skip whitespace after arg itself Pedro Alves
2019-05-22 20:53 ` [PATCH 11/24] number_or_range_parser::get_number, don't treat "1 -" as a range Pedro Alves
2019-05-22 20:53 ` Pedro Alves [this message]
2019-05-23 19:28 ` [PATCH 07/24] Remove "show" command completers Sergio Durigan Junior
2019-05-24 11:25 ` Pedro Alves
2019-05-24 14:21 ` Sergio Durigan Junior
2019-05-22 20:53 ` [PATCH 03/24] Fix TID parser bug Pedro Alves
2019-05-22 20:53 ` [PATCH 08/24] gdb.base/settings.exp: Fix comment typo Pedro Alves
2019-05-24 11:40 ` Pedro Alves
2019-05-22 20:53 ` [PATCH 15/24] Introduce rename_cmd Pedro Alves
2019-05-25 19:58 ` Philippe Waroquiers
2019-05-29 16:03 ` Pedro Alves
2019-05-29 18:30 ` Pedro Alves
2019-05-30 10:22 ` Philippe Waroquiers
2019-05-30 20:01 ` Pedro Alves
2019-05-22 20:53 ` [PATCH 19/24] Introduce complete_command Pedro Alves
2019-05-22 20:54 ` [PATCH 02/24] Fix latent bug with custom word point completers Pedro Alves
2019-05-22 20:54 ` [PATCH 10/24] boolean/auto-boolean commands, make "o" ambiguous Pedro Alves
2019-05-22 20:54 ` [PATCH 22/24] Make "thread apply" use the gdb::option framework Pedro Alves
2019-05-25 20:24 ` Philippe Waroquiers
2019-05-29 15:38 ` Pedro Alves
2019-05-22 20:54 ` [PATCH 01/24] Fix latent bug in custom word point completion handling Pedro Alves
2019-05-22 20:54 ` [PATCH 14/24] Migrate rest of compile commands to new options framework Pedro Alves
2019-05-22 20:54 ` [PATCH 20/24] Make "frame apply" support -OPT options Pedro Alves
2019-05-25 20:12 ` Philippe Waroquiers
2019-05-29 15:13 ` Pedro Alves
2019-05-29 15:25 ` Pedro Alves
2019-05-22 20:54 ` [PATCH 05/24] Allow "unlimited" abbreviations Pedro Alves
2019-05-22 20:54 ` [PATCH 06/24] Fix "set enum-command value garbage" Pedro Alves
2019-05-23 19:13 ` Sergio Durigan Junior
2019-05-24 11:39 ` Pedro Alves
2019-05-22 20:54 ` [PATCH 21/24] "thread apply 1 -- -" vs "frame apply level 0 -- -" Pedro Alves
2019-05-22 20:54 ` [PATCH 12/24] Introduce generic command options framework Pedro Alves
2019-05-25 7:43 ` Philippe Waroquiers
2019-05-25 10:31 ` Pedro Alves
2019-05-22 20:54 ` [PATCH 09/24] New set/show testing framework (gdb.base/settings.exp) Pedro Alves
2019-05-23 4:15 ` Eli Zaretskii
2019-05-22 20:58 ` [PATCH 13/24] Make "print" and "compile print" support -OPT options Pedro Alves
2019-05-24 19:49 ` Sergio Durigan Junior
2019-05-25 10:10 ` Pedro Alves
2019-05-25 10:37 ` Andreas Schwab
2019-05-22 20:58 ` [PATCH 16/24] Make "backtrace" " Pedro Alves
2019-05-22 21:00 ` [PATCH 17/24] "backtrace full/no-filters/hide" completer Pedro Alves
2019-05-22 21:00 ` [PATCH 24/24] NEWS and manual changes for command options changes Pedro Alves
2019-05-23 4:31 ` Eli Zaretskii
2019-05-23 15:01 ` Pedro Alves
2019-05-23 15:07 ` Eli Zaretskii
2019-05-23 15:31 ` Pedro Alves
2019-05-25 20:40 ` Philippe Waroquiers
2019-05-29 16:03 ` Pedro Alves
2019-05-22 21:03 ` [PATCH 23/24] Delete parse_flags/parse_flags_qcs Pedro Alves
2019-05-22 21:46 ` [PATCH 00/24] gdb::option framework, "print -OPT", other cmd options Pedro Alves
2019-05-24 19:58 ` Sergio Durigan Junior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190522205327.2568-8-palves@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox