GNU Binutils with patches for OS216
修訂 | 4965a4a21ad77dec1395d7831186e1a0d11fd769 (tree) |
---|---|
時間 | 2019-06-05 07:30:02 |
作者 | Pedro Alves <palves@redh...> |
Commiter | Pedro Alves |
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.
@@ -509,6 +509,9 @@ add_setshow_cmd_full (const char *name, | ||
509 | 509 | full_show_doc, show_list); |
510 | 510 | show->doc_allocated = 1; |
511 | 511 | show->show_value_func = show_func; |
512 | + /* Disable the default symbol completer. Doesn't make much sense | |
513 | + for the "show" command to complete on anything. */ | |
514 | + set_cmd_completer (show, nullptr); | |
512 | 515 | |
513 | 516 | if (set_result != NULL) |
514 | 517 | *set_result = set; |
@@ -633,11 +636,16 @@ add_setshow_string_cmd (const char *name, enum command_class theclass, | ||
633 | 636 | struct cmd_list_element **set_list, |
634 | 637 | struct cmd_list_element **show_list) |
635 | 638 | { |
639 | + cmd_list_element *set_cmd; | |
640 | + | |
636 | 641 | add_setshow_cmd_full (name, theclass, var_string, var, |
637 | 642 | set_doc, show_doc, help_doc, |
638 | 643 | set_func, show_func, |
639 | 644 | set_list, show_list, |
640 | - NULL, NULL); | |
645 | + &set_cmd, NULL); | |
646 | + | |
647 | + /* Disable the default symbol completer. */ | |
648 | + set_cmd_completer (set_cmd, nullptr); | |
641 | 649 | } |
642 | 650 | |
643 | 651 | /* 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, | ||
659 | 667 | set_func, show_func, |
660 | 668 | set_list, show_list, |
661 | 669 | &set_cmd, NULL); |
670 | + | |
671 | + /* Disable the default symbol completer. */ | |
672 | + set_cmd_completer (set_cmd, nullptr); | |
673 | + | |
662 | 674 | return set_cmd; |
663 | 675 | } |
664 | 676 |