diff options
author | Andrew Burgess <aburgess@redhat.com> | 2022-01-06 12:53:20 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2022-01-06 15:44:50 +0000 |
commit | 10a85f29c74ab562db622cfc4f58997e859c6ed6 (patch) | |
tree | 30d45dd6c8e647f3a92502c34e61081f9d308d84 /gdb/gnu-nat.c | |
parent | 390abcd903a470c0d3ede640dcb0b7cb62ee9852 (diff) | |
download | gdb-10a85f29c74ab562db622cfc4f58997e859c6ed6.zip gdb-10a85f29c74ab562db622cfc4f58997e859c6ed6.tar.gz gdb-10a85f29c74ab562db622cfc4f58997e859c6ed6.tar.bz2 |
gdb: make use add_setshow_prefix_cmd in gnu-nat.c
In gnu-nat.c we currently implement some set/show prefix commands
"manually", that is, we call add_prefix_cmd, and assign a set and show
function to each prefix command.
These set/show functions print an error indicating that the user
didn't type a complete command.
If we instead switch to using add_setshow_prefix_cmd then we can
delete the set/show functions, GDB provides some default functions,
which give a nice help style summary that lists all of the available
sub-commands, along with a one line summary of what each does.
Though this clearly changes the existing behaviour, I think this
change is acceptable as the new behaviour is more inline with other
set/show prefix commands, and the new behaviour is more informative.
This change will conflict with Tom's change here:
https://sourceware.org/pipermail/gdb-patches/2022-January/184724.html
Where Tom changes the set/show functions that I delete. My suggestion
is that the set/show functions still be deleted even after Tom's
patch (or instead of Tom's patch).
For testing I've build GDB on GNU/Hurd, and manually tested these
functions. I did a grep over the testsuite, and don't believe the
existing error messages are being checked for in any tests.
Diffstat (limited to 'gdb/gnu-nat.c')
-rw-r--r-- | gdb/gnu-nat.c | 59 |
1 files changed, 13 insertions, 46 deletions
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index b7b4869..b39dfaf 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -2701,38 +2701,6 @@ struct cmd_list_element *show_thread_cmd_list = NULL; struct cmd_list_element *set_thread_default_cmd_list = NULL; struct cmd_list_element *show_thread_default_cmd_list = NULL; -static void -set_thread_cmd (const char *args, int from_tty) -{ - fprintf_filtered (gdb_stderr, - "\"set thread\" must be followed by the " - "name of a thread property, or \"default\".\n"); -} - -static void -show_thread_cmd (const char *args, int from_tty) -{ - fprintf_unfiltered (gdb_stderr, - "\"show thread\" must be followed by the " - "name of a thread property, or \"default\".\n"); -} - -static void -set_thread_default_cmd (const char *args, int from_tty) -{ - fprintf_unfiltered (gdb_stderr, - "\"set thread default\" must be followed " - "by the name of a thread property.\n"); -} - -static void -show_thread_default_cmd (const char *args, int from_tty) -{ - fprintf_unfiltered (gdb_stderr, - "\"show thread default\" must be followed " - "by the name of a thread property.\n"); -} - static int parse_int_arg (const char *args, const char *cmd_prefix) { @@ -3417,20 +3385,19 @@ thread_takeover_sc_cmd (const char *args, int from_tty) static void add_thread_commands (void) { - add_prefix_cmd ("thread", no_class, set_thread_cmd, - _("Command prefix for setting thread properties."), - &set_thread_cmd_list, 0, &setlist); - add_prefix_cmd ("default", no_class, show_thread_cmd, - _("Command prefix for setting default thread properties."), - &set_thread_default_cmd_list, 0, - &set_thread_cmd_list); - add_prefix_cmd ("thread", no_class, set_thread_default_cmd, - _("Command prefix for showing thread properties."), - &show_thread_cmd_list, 0, &showlist); - add_prefix_cmd ("default", no_class, show_thread_default_cmd, - _("Command prefix for showing default thread properties."), - &show_thread_default_cmd_list, 0, - &show_thread_cmd_list); + add_setshow_prefix_cmd ("thread", no_class, + _("Command prefix for setting thread properties."), + _("Command prefix for showing thread properties."), + &set_thread_cmd_list, + &show_thread_cmd_list, + &setlist, &showlist); + + add_setshow_prefix_cmd ("default", no_class, + _("Command prefix for setting default thread properties."), + _("Command prefix for showing default thread properties."), + &set_thread_default_cmd_list, + &show_thread_default_cmd_list, + &set_thread_cmd_list, &show_thread_cmd_list); add_cmd ("pause", class_run, set_thread_pause_cmd, _("\ Set whether the current thread is suspended while gdb has control.\n\ |