From: Tom Tromey Date: Sat, 11 Jan 2025 20:50:50 +0000 (-0700) Subject: Avoid calling help_list in more places X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=af16bf565f83e1fd71d6acfed05d670993528a0d;p=thirdparty%2Fbinutils-gdb.git Avoid calling help_list in more places I think there is no need to have a prefix command that simply calls help_list. Instead, add_basic_prefix_cmd can be used. This patch changes the relevant instances. In one spot, add_setshow_prefix_cmd is used instead. --- diff --git a/gdb/printcmd.c b/gdb/printcmd.c index f1aaa644042..a9c4e935f3a 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -2922,14 +2922,6 @@ show_memory_tagging_unsupported (void) " architecture.")); } -/* Implement the "memory-tag" prefix command. */ - -static void -memory_tag_command (const char *arg, int from_tty) -{ - help_list (memory_tag_list, "memory-tag ", all_commands, gdb_stdout); -} - /* Helper for print-logical-tag and print-allocation-tag. */ static void @@ -3386,7 +3378,7 @@ Convert the arguments to a string as \"printf\" would, but then\n\ treat this string as a command line, and evaluate it.")); /* Memory tagging commands. */ - add_prefix_cmd ("memory-tag", class_vars, memory_tag_command, _("\ + add_basic_prefix_cmd ("memory-tag", class_vars, _("\ Generic command for printing and manipulating memory tag properties."), &memory_tag_list, 0, &cmdlist); add_cmd ("print-logical-tag", class_vars, diff --git a/gdb/source.c b/gdb/source.c index a225280e794..0d6523cd305 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1909,22 +1909,6 @@ source_lines_range::source_lines_range (int startline, } } -/* Handle the "set source" base command. */ - -static void -set_source (const char *arg, int from_tty) -{ - help_list (setsourcelist, "set source ", all_commands, gdb_stdout); -} - -/* Handle the "show source" base command. */ - -static void -show_source (const char *args, int from_tty) -{ - help_list (showsourcelist, "show source ", all_commands, gdb_stdout); -} - void _initialize_source (); void @@ -2045,13 +2029,12 @@ By default, relative filenames are displayed."), show_filename_display_string, &setlist, &showlist); - add_prefix_cmd ("source", no_class, set_source, - _("Generic command for setting how sources are handled."), - &setsourcelist, 0, &setlist); - - add_prefix_cmd ("source", no_class, show_source, - _("Generic command for showing source settings."), - &showsourcelist, 0, &showlist); + add_setshow_prefix_cmd + ("source", no_class, + _("Generic command for setting how sources are handled."), + _("Generic command for showing source settings."), + &setsourcelist, &showsourcelist, + &setlist, &showlist); add_setshow_boolean_cmd ("open", class_files, &source_open, _("\ Set whether GDB should open source files."), _("\ diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index 2b6cb3194ae..79b7289c2a6 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -1120,14 +1120,6 @@ destroy_layout (struct cmd_list_element *self, void *context) static struct cmd_list_element *layout_list; -/* Called to implement 'tui layout'. */ - -static void -tui_layout_command (const char *args, int from_tty) -{ - help_list (layout_list, "tui layout ", all_commands, gdb_stdout); -} - /* Add a "layout" command with name NAME that switches to LAYOUT. */ static struct cmd_list_element * @@ -1307,7 +1299,7 @@ void _initialize_tui_layout () { struct cmd_list_element *layout_cmd - = add_prefix_cmd ("layout", class_tui, tui_layout_command, _("\ + = add_basic_prefix_cmd ("layout", class_tui, _("\ Change the layout of windows.\n\ Usage: tui layout prev | next | LAYOUT-NAME"), &layout_list, 0, tui_get_cmd_list ()); diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 414d4699bea..33b24d8946d 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -1082,14 +1082,6 @@ parse_scrolling_args (const char *arg, static cmd_list_element *tui_window_cmds = nullptr; -/* Called to implement 'tui window'. */ - -static void -tui_window_command (const char *args, int from_tty) -{ - help_list (tui_window_cmds, "tui window ", all_commands, gdb_stdout); -} - /* See tui-win.h. */ bool tui_left_margin_verbose = false; @@ -1125,9 +1117,9 @@ Usage: tabset N")); deprecate_cmd (tabset_cmd, "set tui tab-width"); /* Setup the 'tui window' list of command. */ - add_prefix_cmd ("window", class_tui, tui_window_command, - _("Text User Interface window commands."), - &tui_window_cmds, 1, tui_get_cmd_list ()); + add_basic_prefix_cmd ("window", class_tui, + _("Text User Interface window commands."), + &tui_window_cmds, 1, tui_get_cmd_list ()); cmd_list_element *winheight_cmd = add_cmd ("height", class_tui, tui_set_win_height_command, _("\