aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ada-lang.c8
-rw-r--r--gdb/arc-tdep.c2
-rw-r--r--gdb/arm-tdep.c4
-rw-r--r--gdb/auto-load.c9
-rw-r--r--gdb/breakpoint.c20
-rw-r--r--gdb/bsd-kvm.c2
-rw-r--r--gdb/btrace.c9
-rw-r--r--gdb/cli/cli-cmds.c12
-rw-r--r--gdb/cli/cli-decode.c51
-rw-r--r--gdb/cli/cli-decode.h26
-rw-r--r--gdb/cli/cli-dump.c16
-rw-r--r--gdb/cli/cli-logging.c4
-rw-r--r--gdb/cli/cli-script.c7
-rw-r--r--gdb/cli/cli-setshow.c18
-rw-r--r--gdb/cli/cli-style.c11
-rw-r--r--gdb/cli/cli-style.h3
-rw-r--r--gdb/command.h10
-rw-r--r--gdb/compile/compile.c2
-rw-r--r--gdb/cp-support.c1
-rw-r--r--gdb/dcache.c5
-rw-r--r--gdb/dwarf2/index-cache.c4
-rw-r--r--gdb/dwarf2/read.c4
-rw-r--r--gdb/f-lang.c4
-rw-r--r--gdb/frame.c4
-rw-r--r--gdb/gnu-nat.c12
-rw-r--r--gdb/go32-nat.c2
-rw-r--r--gdb/guile/guile.c9
-rw-r--r--gdb/guile/scm-cmd.c2
-rw-r--r--gdb/i386-tdep.c4
-rw-r--r--gdb/infcmd.c8
-rw-r--r--gdb/language.c4
-rw-r--r--gdb/macrocmd.c2
-rw-r--r--gdb/maint-test-options.c3
-rw-r--r--gdb/maint-test-settings.c2
-rw-r--r--gdb/maint.c18
-rw-r--r--gdb/memattr.c4
-rw-r--r--gdb/mips-tdep.c6
-rw-r--r--gdb/printcmd.c4
-rw-r--r--gdb/probe.c3
-rw-r--r--gdb/python/py-cmd.c51
-rw-r--r--gdb/python/python.c6
-rw-r--r--gdb/ravenscar-thread.c4
-rw-r--r--gdb/record-btrace.c16
-rw-r--r--gdb/record-full.c6
-rw-r--r--gdb/record.c10
-rw-r--r--gdb/remote.c6
-rw-r--r--gdb/riscv-tdep.c8
-rw-r--r--gdb/rs6000-tdep.c4
-rw-r--r--gdb/ser-tcp.c4
-rw-r--r--gdb/serial.c4
-rw-r--r--gdb/sh-tdep.c4
-rw-r--r--gdb/skip.c2
-rw-r--r--gdb/sparc64-tdep.c2
-rw-r--r--gdb/stack.c8
-rw-r--r--gdb/symfile.c2
-rw-r--r--gdb/symtab.c3
-rw-r--r--gdb/target-descriptions.c6
-rw-r--r--gdb/target.c2
-rw-r--r--gdb/thread.c4
-rw-r--r--gdb/top.c10
-rw-r--r--gdb/tracepoint.c2
-rw-r--r--gdb/tui/tui-layout.c2
-rw-r--r--gdb/tui/tui-win.c8
-rw-r--r--gdb/typeprint.c6
-rw-r--r--gdb/unittests/command-def-selftests.c4
-rw-r--r--gdb/utils.c4
-rw-r--r--gdb/valprint.c10
-rw-r--r--gdb/value.c2
-rw-r--r--gdb/windows-tdep.c2
69 files changed, 236 insertions, 285 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 34b0e92..2a257c2 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -13389,11 +13389,11 @@ _initialize_ada_language ()
add_basic_prefix_cmd ("ada", no_class,
_("Prefix command for changing Ada-specific settings."),
- &set_ada_list, "set ada ", 0, &setlist);
+ &set_ada_list, 0, &setlist);
add_show_prefix_cmd ("ada", no_class,
_("Generic command for showing Ada-specific settings."),
- &show_ada_list, "show ada ", 0, &showlist);
+ &show_ada_list, 0, &showlist);
add_setshow_boolean_cmd ("trust-PAD-over-XVS", class_obscure,
&trust_pad_over_xvs, _("\
@@ -13472,12 +13472,12 @@ the regular expression are listed."));
add_basic_prefix_cmd ("ada", class_maintenance,
_("Set Ada maintenance-related variables."),
- &maint_set_ada_cmdlist, "maintenance set ada ",
+ &maint_set_ada_cmdlist,
0/*allow-unknown*/, &maintenance_set_cmdlist);
add_show_prefix_cmd ("ada", class_maintenance,
_("Show Ada maintenance-related variables."),
- &maint_show_ada_cmdlist, "maintenance show ada ",
+ &maint_show_ada_cmdlist,
0/*allow-unknown*/, &maintenance_show_cmdlist);
add_setshow_boolean_cmd
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index 8a1da1a..ece8025 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -2495,7 +2495,7 @@ _initialize_arc_tdep ()
add_show_prefix_cmd ("arc", class_maintenance,
_("ARC-specific maintenance commands for printing GDB "
"internal state."),
- &maintenance_print_arc_list, "maintenance print arc ",
+ &maintenance_print_arc_list,
0, &maintenanceprintlist);
add_cmd ("arc-instruction", class_maintenance,
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index c473843..7f56d00 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -9563,11 +9563,11 @@ _initialize_arm_tdep ()
/* Add root prefix command for all "set arm"/"show arm" commands. */
add_basic_prefix_cmd ("arm", no_class,
_("Various ARM-specific commands."),
- &setarmcmdlist, "set arm ", 0, &setlist);
+ &setarmcmdlist, 0, &setlist);
add_show_prefix_cmd ("arm", no_class,
_("Various ARM-specific commands."),
- &showarmcmdlist, "show arm ", 0, &showlist);
+ &showarmcmdlist, 0, &showlist);
arm_disassembler_options = xstrdup ("reg-names-std");
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index d1ae6de..b9478c4 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -1427,8 +1427,7 @@ auto_load_set_cmdlist_get (void)
Auto-loading specific settings.\n\
Configure various auto-load-specific variables such as\n\
automatic loading of Python scripts."),
- &retval, "set auto-load ",
- 1/*allow-unknown*/, &setlist);
+ &retval, 1/*allow-unknown*/, &setlist);
return &retval;
}
@@ -1445,8 +1444,7 @@ auto_load_show_cmdlist_get (void)
Show auto-loading specific settings.\n\
Show configuration of various auto-load-specific variables such as\n\
automatic loading of Python scripts."),
- &retval, "show auto-load ",
- 0/*allow-unknown*/, &showlist);
+ &retval, 0/*allow-unknown*/, &showlist);
return &retval;
}
@@ -1488,8 +1486,7 @@ auto_load_info_cmdlist_get (void)
Print current status of auto-loaded files.\n\
Print whether various files like Python scripts or .gdbinit files have been\n\
found and/or loaded."),
- &retval, "info auto-load ",
- 0/*allow-unknown*/, &infolist);
+ &retval, 0/*allow-unknown*/, &infolist);
return &retval;
}
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 38406b4..d479f00 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -15731,7 +15731,7 @@ Give breakpoint numbers (separated by spaces) as arguments.\n\
With no subcommand, breakpoints are enabled until you command otherwise.\n\
This is used to cancel the effect of the \"disable\" command.\n\
With a subcommand you can enable temporarily."),
- &enablelist, "enable ", 1, &cmdlist);
+ &enablelist, 1, &cmdlist);
add_com_alias ("en", "enable", class_breakpoint, 1);
@@ -15741,7 +15741,7 @@ Usage: enable breakpoints [BREAKPOINTNUM]...\n\
Give breakpoint numbers (separated by spaces) as arguments.\n\
This is used to cancel the effect of the \"disable\" command.\n\
May be abbreviated to simply \"enable\"."),
- &enablebreaklist, "enable breakpoints ", 1, &enablelist);
+ &enablebreaklist, 1, &enablelist);
add_cmd ("once", no_class, enable_once_command, _("\
Enable some breakpoints for one hit.\n\
@@ -15787,7 +15787,7 @@ Usage: disable [BREAKPOINTNUM]...\n\
Arguments are breakpoint numbers with spaces in between.\n\
To disable all breakpoints, give no argument.\n\
A disabled breakpoint is not forgotten, but has no effect until re-enabled."),
- &disablelist, "disable ", 1, &cmdlist);
+ &disablelist, 1, &cmdlist);
add_com_alias ("dis", "disable", class_breakpoint, 1);
add_com_alias ("disa", "disable", class_breakpoint, 1);
@@ -15807,7 +15807,7 @@ Arguments are breakpoint numbers with spaces in between.\n\
To delete all breakpoints, give no argument.\n\
\n\
Also a prefix command for deletion of other GDB objects."),
- &deletelist, "delete ", 1, &cmdlist);
+ &deletelist, 1, &cmdlist);
add_com_alias ("d", "delete", class_breakpoint, 1);
add_com_alias ("del", "delete", class_breakpoint, 1);
@@ -15843,7 +15843,7 @@ BREAK_ARGS_HELP ("break")));
{
add_abbrev_prefix_cmd ("stop", class_breakpoint, stop_command, _("\
Break in function/address or break at a line in the current file."),
- &stoplist, "stop ", 1, &cmdlist);
+ &stoplist, 1, &cmdlist);
add_cmd ("in", class_breakpoint, stopin_command,
_("Break in function or address."), &stoplist);
add_cmd ("at", class_breakpoint, stopat_command,
@@ -15906,12 +15906,12 @@ breakpoint set."),
add_basic_prefix_cmd ("catch", class_breakpoint, _("\
Set catchpoints to catch events."),
- &catch_cmdlist, "catch ",
+ &catch_cmdlist,
0/*allow-unknown*/, &cmdlist);
add_basic_prefix_cmd ("tcatch", class_breakpoint, _("\
Set temporary catchpoints to catch events."),
- &tcatch_cmdlist, "tcatch ",
+ &tcatch_cmdlist,
0/*allow-unknown*/, &cmdlist);
add_catch_command ("fork", _("Catch calls to fork."),
@@ -16083,7 +16083,7 @@ if TPNUM is omitted, passcount refers to the last tracepoint defined."));
add_basic_prefix_cmd ("save", class_breakpoint,
_("Save breakpoint definitions as a script."),
- &save_cmdlist, "save ",
+ &save_cmdlist,
0/*allow-unknown*/, &cmdlist);
c = add_cmd ("breakpoints", class_breakpoint, save_breakpoints_command, _("\
@@ -16107,13 +16107,13 @@ Use the 'source' command in another debug session to restore them."),
Breakpoint specific settings.\n\
Configure various breakpoint-specific variables such as\n\
pending breakpoint behavior."),
- &breakpoint_set_cmdlist, "set breakpoint ",
+ &breakpoint_set_cmdlist,
0/*allow-unknown*/, &setlist);
add_show_prefix_cmd ("breakpoint", class_maintenance, _("\
Breakpoint specific settings.\n\
Configure various breakpoint-specific variables such as\n\
pending breakpoint behavior."),
- &breakpoint_show_cmdlist, "show breakpoint ",
+ &breakpoint_show_cmdlist,
0/*allow-unknown*/, &showlist);
add_setshow_auto_boolean_cmd ("pending", no_class,
diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c
index 89da40a..d058aac 100644
--- a/gdb/bsd-kvm.c
+++ b/gdb/bsd-kvm.c
@@ -388,7 +388,7 @@ bsd_kvm_add_target (int (*supply_pcb)(struct regcache *, struct pcb *))
add_prefix_cmd ("kvm", class_obscure, bsd_kvm_cmd, _("\
Generic command for manipulating the kernel memory interface."),
- &bsd_kvm_cmdlist, "kvm ", 0, &cmdlist);
+ &bsd_kvm_cmdlist, 0, &cmdlist);
#ifndef HAVE_STRUCT_THREAD_TD_PCB
add_cmd ("proc", class_obscure, bsd_kvm_proc_cmd,
diff --git a/gdb/btrace.c b/gdb/btrace.c
index 17eb56c..5e689c1 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -3441,29 +3441,26 @@ _initialize_btrace ()
add_basic_prefix_cmd ("btrace", class_maintenance,
_("Branch tracing maintenance commands."),
- &maint_btrace_cmdlist, "maintenance btrace ",
- 0, &maintenancelist);
+ &maint_btrace_cmdlist, 0, &maintenancelist);
add_basic_prefix_cmd ("btrace", class_maintenance, _("\
Set branch tracing specific variables."),
- &maint_btrace_set_cmdlist, "maintenance set btrace ",
+ &maint_btrace_set_cmdlist,
0, &maintenance_set_cmdlist);
add_basic_prefix_cmd ("pt", class_maintenance, _("\
Set Intel Processor Trace specific variables."),
&maint_btrace_pt_set_cmdlist,
- "maintenance set btrace pt ",
0, &maint_btrace_set_cmdlist);
add_show_prefix_cmd ("btrace", class_maintenance, _("\
Show branch tracing specific variables."),
- &maint_btrace_show_cmdlist, "maintenance show btrace ",
+ &maint_btrace_show_cmdlist,
0, &maintenance_show_cmdlist);
add_show_prefix_cmd ("pt", class_maintenance, _("\
Show Intel Processor Trace specific variables."),
&maint_btrace_pt_show_cmdlist,
- "maintenance show btrace pt ",
0, &maint_btrace_show_cmdlist);
add_setshow_boolean_cmd ("skip-pad", class_maintenance,
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 62948f5..284b751 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -2352,10 +2352,10 @@ Show verbosity."), NULL,
add_basic_prefix_cmd ("history", class_support, _("\
Generic command for setting command history parameters."),
- &sethistlist, "set history ", 0, &setlist);
+ &sethistlist, 0, &setlist);
add_show_prefix_cmd ("history", class_support, _("\
Generic command for showing command history parameters."),
- &showhistlist, "show history ", 0, &showlist);
+ &showhistlist, 0, &showlist);
add_setshow_boolean_cmd ("expansion", no_class, &history_expansion_p, _("\
Set history expansion on command input."), _("\
@@ -2367,7 +2367,7 @@ Without an argument, history expansion is enabled."),
add_prefix_cmd ("info", class_info, info_command, _("\
Generic command for showing things about the program being debugged."),
- &infolist, "info ", 0, &cmdlist);
+ &infolist, 0, &cmdlist);
add_com_alias ("i", "info", class_info, 1);
add_com_alias ("inf", "info", class_info, 1);
@@ -2376,7 +2376,7 @@ Generic command for showing things about the program being debugged."),
c = add_show_prefix_cmd ("show", class_info, _("\
Generic command for showing things about the debugger."),
- &showlist, "show ", 0, &cmdlist);
+ &showlist, 0, &cmdlist);
/* Another way to get at the same thing. */
add_alias_cmd ("set", c, class_info, 0, &infolist);
@@ -2449,11 +2449,11 @@ the previous command number shown."),
add_basic_prefix_cmd ("debug", no_class,
_("Generic command for setting gdb debugging flags."),
- &setdebuglist, "set debug ", 0, &setlist);
+ &setdebuglist, 0, &setlist);
add_show_prefix_cmd ("debug", no_class,
_("Generic command for showing gdb debugging flags."),
- &showdebuglist, "show debug ", 0, &showlist);
+ &showdebuglist, 0, &showlist);
c = add_com ("shell", class_support, shell_command, _("\
Execute the rest of the line as a shell command.\n\
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index f48a9ad..32edb52 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -318,7 +318,6 @@ add_alias_cmd (const char *name, cmd_list_element *old,
c->func = old->func;
c->function = old->function;
c->prefixlist = old->prefixlist;
- c->prefixname = old->prefixname;
c->allow_unknown = old->allow_unknown;
c->abbrev_flag = abbrev_flag;
c->cmd_pointer = old;
@@ -383,13 +382,11 @@ struct cmd_list_element *
add_prefix_cmd (const char *name, enum command_class theclass,
cmd_const_cfunc_ftype *fun,
const char *doc, struct cmd_list_element **prefixlist,
- const char *prefixname, int allow_unknown,
- struct cmd_list_element **list)
+ int allow_unknown, struct cmd_list_element **list)
{
struct cmd_list_element *c = add_cmd (name, theclass, fun, doc, list);
c->prefixlist = prefixlist;
- c->prefixname = prefixname;
c->allow_unknown = allow_unknown;
/* Now that prefix command C is defined, we need to set the prefix field
@@ -409,7 +406,8 @@ do_prefix_cmd (const char *args, int from_tty, struct cmd_list_element *c)
while (c->cmd_pointer != nullptr)
c = c->cmd_pointer;
- help_list (*c->prefixlist, c->prefixname, all_commands, gdb_stdout);
+ help_list (*c->prefixlist, c->prefixname ().c_str (),
+ all_commands, gdb_stdout);
}
/* See command.h. */
@@ -417,11 +415,10 @@ do_prefix_cmd (const char *args, int from_tty, struct cmd_list_element *c)
struct cmd_list_element *
add_basic_prefix_cmd (const char *name, enum command_class theclass,
const char *doc, struct cmd_list_element **prefixlist,
- const char *prefixname, int allow_unknown,
- struct cmd_list_element **list)
+ int allow_unknown, struct cmd_list_element **list)
{
struct cmd_list_element *cmd = add_prefix_cmd (name, theclass, nullptr,
- doc, prefixlist, prefixname,
+ doc, prefixlist,
allow_unknown, list);
set_cmd_sfunc (cmd, do_prefix_cmd);
return cmd;
@@ -441,11 +438,10 @@ do_show_prefix_cmd (const char *args, int from_tty, struct cmd_list_element *c)
struct cmd_list_element *
add_show_prefix_cmd (const char *name, enum command_class theclass,
const char *doc, struct cmd_list_element **prefixlist,
- const char *prefixname, int allow_unknown,
- struct cmd_list_element **list)
+ int allow_unknown, struct cmd_list_element **list)
{
struct cmd_list_element *cmd = add_prefix_cmd (name, theclass, nullptr,
- doc, prefixlist, prefixname,
+ doc, prefixlist,
allow_unknown, list);
set_cmd_sfunc (cmd, do_show_prefix_cmd);
return cmd;
@@ -459,13 +455,12 @@ add_prefix_cmd_suppress_notification
(const char *name, enum command_class theclass,
cmd_const_cfunc_ftype *fun,
const char *doc, struct cmd_list_element **prefixlist,
- const char *prefixname, int allow_unknown,
- struct cmd_list_element **list,
+ int allow_unknown, struct cmd_list_element **list,
int *suppress_notification)
{
struct cmd_list_element *element
= add_prefix_cmd (name, theclass, fun, doc, prefixlist,
- prefixname, allow_unknown, list);
+ allow_unknown, list);
element->suppress_notification = suppress_notification;
return element;
}
@@ -476,13 +471,11 @@ struct cmd_list_element *
add_abbrev_prefix_cmd (const char *name, enum command_class theclass,
cmd_const_cfunc_ftype *fun, const char *doc,
struct cmd_list_element **prefixlist,
- const char *prefixname,
int allow_unknown, struct cmd_list_element **list)
{
struct cmd_list_element *c = add_cmd (name, theclass, fun, doc, list);
c->prefixlist = prefixlist;
- c->prefixname = prefixname;
c->allow_unknown = allow_unknown;
c->abbrev_flag = 1;
return c;
@@ -1034,10 +1027,11 @@ add_com_suppress_notification (const char *name, enum command_class theclass,
static void
fput_command_name_styled (struct cmd_list_element *c, struct ui_file *stream)
{
- const char *prefixname
- = c->prefix == nullptr ? "" : c->prefix->prefixname;
+ std::string prefixname
+ = c->prefix == nullptr ? "" : c->prefix->prefixname ();
- fprintf_styled (stream, title_style.style (), "%s%s", prefixname, c->name);
+ fprintf_styled (stream, title_style.style (), "%s%s",
+ prefixname.c_str (), c->name);
}
/* Print the definition of alias C using title style for alias
@@ -1192,7 +1186,8 @@ apropos_cmd (struct ui_file *stream,
{
/* Recursively call ourselves on the subcommand list,
passing the right prefix in. */
- apropos_cmd (stream, *c->prefixlist, verbose, regex, c->prefixname);
+ apropos_cmd (stream, *c->prefixlist, verbose, regex,
+ c->prefixname ().c_str ());
}
}
}
@@ -1258,7 +1253,8 @@ help_cmd (const char *command, struct ui_file *stream)
/* If this is a prefix command, print it's subcommands. */
if (c->prefixlist)
- help_list (*c->prefixlist, c->prefixname, all_commands, stream);
+ help_list (*c->prefixlist, c->prefixname ().c_str (),
+ all_commands, stream);
/* If this is a class name, print all of the commands in the class. */
if (c->func == NULL)
@@ -1812,7 +1808,8 @@ lookup_cmd (const char **line, struct cmd_list_element *list,
values. */
int local_allow_unknown = (last_list ? last_list->allow_unknown :
allow_unknown);
- const char *local_cmdtype = last_list ? last_list->prefixname : cmdtype;
+ std::string local_cmdtype
+ = last_list ? last_list->prefixname () : cmdtype;
struct cmd_list_element *local_list =
(last_list ? *(last_list->prefixlist) : list);
@@ -1852,8 +1849,8 @@ lookup_cmd (const char **line, struct cmd_list_element *list,
break;
}
}
- error (_("Ambiguous %scommand \"%s\": %s."), local_cmdtype,
- *line, ambbuf);
+ error (_("Ambiguous %scommand \"%s\": %s."),
+ local_cmdtype.c_str (), *line, ambbuf);
}
}
else
@@ -1867,7 +1864,7 @@ lookup_cmd (const char **line, struct cmd_list_element *list,
(*line)++;
if (c->prefixlist && **line && !c->allow_unknown)
- undef_cmd_error (c->prefixname, *line);
+ undef_cmd_error (c->prefixname ().c_str (), *line);
/* Seems to be what he wants. Return it. */
return c;
@@ -1940,7 +1937,7 @@ deprecated_cmd_warning (const char *text, struct cmd_list_element *list)
/* Join command prefix (if any) and the command name. */
std::string tmp_cmd_str;
if (cmd->prefix != nullptr)
- tmp_cmd_str += std::string (cmd->prefix->prefixname);
+ tmp_cmd_str += cmd->prefix->prefixname ();
tmp_cmd_str += std::string (cmd->name);
/* Display the appropriate first line, this warns that the thing the user
@@ -1950,7 +1947,7 @@ deprecated_cmd_warning (const char *text, struct cmd_list_element *list)
/* Join the alias prefix (if any) and the alias name. */
std::string tmp_alias_str;
if (alias->prefix != nullptr)
- tmp_alias_str += std::string (alias->prefix->prefixname);
+ tmp_alias_str += alias->prefix->prefixname ();
tmp_alias_str += std::string (alias->name);
if (cmd->cmd_deprecated)
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index d6f52a2..214428e 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -71,6 +71,25 @@ struct cmd_list_element
DISABLE_COPY_AND_ASSIGN (cmd_list_element);
+ /* For prefix commands, return a string containing prefix commands to
+ get here: this one plus any others needed to get to it. Ends in a
+ space. It is used before the word "command" in describing the
+ commands reached through this prefix.
+
+ For non-prefix commands, an empty string is returned. */
+ std::string prefixname ()
+ {
+ if (prefixlist == nullptr)
+ /* Not a prefix command. */
+ return "";
+
+ std::string prefixname;
+ if (prefix != nullptr)
+ prefixname = prefix->prefixname ();
+ prefixname += name;
+ prefixname += " ";
+ return prefixname;
+ }
/* Points to next command in this list. */
struct cmd_list_element *next = nullptr;
@@ -186,13 +205,6 @@ struct cmd_list_element
of the variable containing the list of subcommands. */
struct cmd_list_element **prefixlist = nullptr;
- /* For prefix commands only:
- String containing prefix commands to get here: this one
- plus any others needed to get to it. Should end in a space.
- It is used before the word "command" in describing the
- commands reached through this prefix. */
- const char *prefixname = nullptr;
-
/* The prefix command of this command. */
struct cmd_list_element *prefix = nullptr;
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index 1df2662..95ce85e 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -572,12 +572,12 @@ _initialize_cli_dump ()
add_basic_prefix_cmd ("dump", class_vars,
_("Dump target code/data to a local file."),
- &dump_cmdlist, "dump ",
+ &dump_cmdlist,
0/*allow-unknown*/,
&cmdlist);
add_basic_prefix_cmd ("append", class_vars,
_("Append target code/data to a local file."),
- &append_cmdlist, "append ",
+ &append_cmdlist,
0/*allow-unknown*/,
&cmdlist);
@@ -593,37 +593,37 @@ the specified FILE in raw target ordered bytes.");
add_basic_prefix_cmd ("srec", all_commands,
_("Write target code/data to an srec file."),
- &srec_cmdlist, "dump srec ",
+ &srec_cmdlist,
0 /*allow-unknown*/,
&dump_cmdlist);
add_basic_prefix_cmd ("ihex", all_commands,
_("Write target code/data to an intel hex file."),
- &ihex_cmdlist, "dump ihex ",
+ &ihex_cmdlist,
0 /*allow-unknown*/,
&dump_cmdlist);
add_basic_prefix_cmd ("verilog", all_commands,
_("Write target code/data to a verilog hex file."),
- &verilog_cmdlist, "dump verilog ",
+ &verilog_cmdlist,
0 /*allow-unknown*/,
&dump_cmdlist);
add_basic_prefix_cmd ("tekhex", all_commands,
_("Write target code/data to a tekhex file."),
- &tekhex_cmdlist, "dump tekhex ",
+ &tekhex_cmdlist,
0 /*allow-unknown*/,
&dump_cmdlist);
add_basic_prefix_cmd ("binary", all_commands,
_("Write target code/data to a raw binary file."),
- &binary_dump_cmdlist, "dump binary ",
+ &binary_dump_cmdlist,
0 /*allow-unknown*/,
&dump_cmdlist);
add_basic_prefix_cmd ("binary", all_commands,
_("Append target code/data to a raw binary file."),
- &binary_append_cmdlist, "append binary ",
+ &binary_append_cmdlist,
0 /*allow-unknown*/,
&append_cmdlist);
diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c
index 9cde7b9..dfedd75 100644
--- a/gdb/cli/cli-logging.c
+++ b/gdb/cli/cli-logging.c
@@ -173,10 +173,10 @@ _initialize_cli_logging ()
add_basic_prefix_cmd ("logging", class_support,
_("Set logging options."), &set_logging_cmdlist,
- "set logging ", 0, &setlist);
+ 0, &setlist);
add_show_prefix_cmd ("logging", class_support,
_("Show logging options."), &show_logging_cmdlist,
- "show logging ", 0, &showlist);
+ 0, &showlist);
add_setshow_boolean_cmd ("overwrite", class_support, &logging_overwrite, _("\
Set whether logging overwrites or appends to the log file."), _("\
Show whether logging overwrites or appends to the log file."), _("\
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 0544f3e..eb8853a 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -1472,7 +1472,6 @@ do_define_command (const char *comname, int from_tty,
{
struct cmd_list_element **c_prefixlist
= c == nullptr ? nullptr : c->prefixlist;
- const char *c_prefixname = c == nullptr ? nullptr : c->prefixname;
newc = add_cmd (comname, class_user, user_defined_command,
(c != nullptr && c->theclass == class_user)
@@ -1484,7 +1483,6 @@ do_define_command (const char *comname, int from_tty,
if (c_prefixlist != nullptr)
{
newc->prefixlist = c_prefixlist;
- newc->prefixname = c_prefixname;
/* allow_unknown: see explanation in equivalent logic in
define_prefix_command (). */
newc->allow_unknown = newc->user_commands.get () != nullptr;
@@ -1615,7 +1613,6 @@ define_prefix_command (const char *comname, int from_tty)
command. */
c->prefixlist = new struct cmd_list_element*;
*(c->prefixlist) = nullptr;
- c->prefixname = xstrprintf ("%s ", comfull);
/* If the prefix command C is not a command, then it must be followed
by known subcommands. Otherwise, if C is also a normal command,
it can be followed by C args that must not cause a 'subcommand'
@@ -1681,11 +1678,11 @@ show_user_1 (struct cmd_list_element *c, const char *prefix, const char *name,
if (c->prefixlist != NULL)
{
- const char *prefixname = c->prefixname;
+ const std::string prefixname = c->prefixname ();
for (c = *c->prefixlist; c != NULL; c = c->next)
if (c->theclass == class_user || c->prefixlist != NULL)
- show_user_1 (c, prefixname, c->name, gdb_stdout);
+ show_user_1 (c, prefixname.c_str (), c->name, gdb_stdout);
}
}
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index 1a8c6e2..1b14df7 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -747,7 +747,8 @@ cmd_show_list (struct cmd_list_element *list, int from_tty)
if (list->prefixlist && list->cmd_pointer == nullptr)
{
ui_out_emit_tuple optionlist_emitter (uiout, "optionlist");
- const char *new_prefix = strstr (list->prefixname, "show ") + 5;
+ std::string prefixname = list->prefixname ();
+ const char *new_prefix = strstr (prefixname.c_str (), "show ") + 5;
if (uiout->is_mi_like_p ())
uiout->field_string ("prefix", new_prefix);
@@ -757,13 +758,14 @@ cmd_show_list (struct cmd_list_element *list, int from_tty)
{
ui_out_emit_tuple option_emitter (uiout, "option");
- {
- /* If we find a prefix, output it (with "show " skipped). */
- const char *prefixname
- = (list->prefix == nullptr ? ""
- : strstr (list->prefix->prefixname, "show ") + 5);
- uiout->text (prefixname);
- }
+ if (list->prefix != nullptr)
+ {
+ /* If we find a prefix, output it (with "show " skipped). */
+ std::string prefixname = list->prefix->prefixname ();
+ prefixname = (list->prefix->prefixlist == nullptr ? ""
+ : strstr (prefixname.c_str (), "show ") + 5);
+ uiout->text (prefixname.c_str ());
+ }
uiout->field_string ("name", list->name);
uiout->text (": ");
if (list->type == show_cmd)
diff --git a/gdb/cli/cli-style.c b/gdb/cli/cli-style.c
index 8b4b6b2..25a1d88 100644
--- a/gdb/cli/cli-style.c
+++ b/gdb/cli/cli-style.c
@@ -225,13 +225,10 @@ cli_style_option::add_setshow_commands (enum command_class theclass,
struct cmd_list_element **show_list,
bool skip_intensity)
{
- m_set_prefix = std::string ("set style ") + m_name + " ";
- m_show_prefix = std::string ("show style ") + m_name + " ";
-
add_basic_prefix_cmd (m_name, no_class, prefix_doc, &m_set_list,
- m_set_prefix.c_str (), 0, set_list);
+ 0, set_list);
add_show_prefix_cmd (m_name, no_class, prefix_doc, &m_show_list,
- m_show_prefix.c_str (), 0, show_list);
+ 0, show_list);
add_setshow_enum_cmd ("foreground", theclass, cli_colors,
&m_foreground,
@@ -297,11 +294,11 @@ _initialize_cli_style ()
add_basic_prefix_cmd ("style", no_class, _("\
Style-specific settings.\n\
Configure various style-related variables, such as colors"),
- &style_set_list, "set style ", 0, &setlist);
+ &style_set_list, 0, &setlist);
add_show_prefix_cmd ("style", no_class, _("\
Style-specific settings.\n\
Configure various style-related variables, such as colors"),
- &style_show_list, "show style ", 0, &showlist);
+ &style_show_list, 0, &showlist);
add_setshow_boolean_cmd ("enabled", no_class, &cli_styling, _("\
Set whether CLI styling is enabled."), _("\
diff --git a/gdb/cli/cli-style.h b/gdb/cli/cli-style.h
index 187e1d0..78bc2cd 100644
--- a/gdb/cli/cli-style.h
+++ b/gdb/cli/cli-style.h
@@ -72,9 +72,6 @@ private:
/* The intensity. */
const char *m_intensity;
- /* Storage for prefixes needed when registering the commands. */
- std::string m_show_prefix;
- std::string m_set_prefix;
/* Storage for command lists needed when registering
subcommands. */
struct cmd_list_element *m_set_list = nullptr;
diff --git a/gdb/command.h b/gdb/command.h
index 827a196..33feb19 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -188,7 +188,7 @@ extern struct cmd_list_element *add_prefix_cmd (const char *, enum command_class
cmd_const_cfunc_ftype *fun,
const char *,
struct cmd_list_element **,
- const char *, int,
+ int,
struct cmd_list_element **);
/* Like add_prefix_cmd, but sets the callback to a function that
@@ -196,20 +196,20 @@ extern struct cmd_list_element *add_prefix_cmd (const char *, enum command_class
extern struct cmd_list_element *add_basic_prefix_cmd
(const char *, enum command_class, const char *, struct cmd_list_element **,
- const char *, int, struct cmd_list_element **);
+ int, struct cmd_list_element **);
/* Like add_prefix_cmd, but useful for "show" prefixes. This sets the
callback to a function that simply calls cmd_show_list. */
extern struct cmd_list_element *add_show_prefix_cmd
(const char *, enum command_class, const char *, struct cmd_list_element **,
- const char *, int, struct cmd_list_element **);
+ int, struct cmd_list_element **);
extern struct cmd_list_element *add_prefix_cmd_suppress_notification
(const char *name, enum command_class theclass,
cmd_const_cfunc_ftype *fun,
const char *doc, struct cmd_list_element **prefixlist,
- const char *prefixname, int allow_unknown,
+ int allow_unknown,
struct cmd_list_element **list,
int *suppress_notification);
@@ -218,7 +218,7 @@ extern struct cmd_list_element *add_abbrev_prefix_cmd (const char *,
cmd_const_cfunc_ftype *fun,
const char *,
struct cmd_list_element
- **, const char *, int,
+ **, int,
struct cmd_list_element
**);
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index 5c5d517..c7f7d38 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -930,7 +930,7 @@ _initialize_compile ()
compile_cmd_element = add_prefix_cmd ("compile", class_obscure,
compile_command, _("\
Command to compile source code and inject it into the inferior."),
- &compile_command_list, "compile ", 1, &cmdlist);
+ &compile_command_list, 1, &cmdlist);
add_com_alias ("expression", "compile", class_obscure, 0);
const auto compile_opts = make_compile_options_def_group (nullptr);
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index eba477d..e87c9d4 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -2212,7 +2212,6 @@ _initialize_cp_support ()
add_basic_prefix_cmd ("cplus", class_maintenance,
_("C++ maintenance commands."),
&maint_cplus_cmd_list,
- "maintenance cplus ",
0, &maintenancelist);
add_alias_cmd ("cp", "cplus",
class_maintenance, 1,
diff --git a/gdb/dcache.c b/gdb/dcache.c
index 201505b..50b3854 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -696,11 +696,10 @@ the contents of the given line."));
add_basic_prefix_cmd ("dcache", class_obscure, _("\
Use this command to set number of lines in dcache and line-size."),
- &dcache_set_list, "set dcache ", /*allow_unknown*/0,
- &setlist);
+ &dcache_set_list, /*allow_unknown*/0, &setlist);
add_show_prefix_cmd ("dcache", class_obscure, _("\
Show dcachesettings."),
- &dcache_show_list, "show dcache ", /*allow_unknown*/0,
+ &dcache_show_list, /*allow_unknown*/0,
&showlist);
add_setshow_zuinteger_cmd ("line-size", class_obscure,
diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
index ed8fd8e..c3decf1 100644
--- a/gdb/dwarf2/index-cache.c
+++ b/gdb/dwarf2/index-cache.c
@@ -335,12 +335,12 @@ _initialize_index_cache ()
add_basic_prefix_cmd ("index-cache", class_files,
_("Set index-cache options."),
&set_index_cache_prefix_list,
- "set index-cache ", false, &setlist);
+ false, &setlist);
/* show index-cache */
add_prefix_cmd ("index-cache", class_files, show_index_cache_command,
_("Show index-cache options."), &show_index_cache_prefix_list,
- "show index-cache ", false, &showlist);
+ false, &showlist);
/* set index-cache on */
add_cmd ("on", class_files, set_index_cache_on_command,
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index b2f48f1..280f56c 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -25079,13 +25079,13 @@ _initialize_dwarf2_read ()
add_basic_prefix_cmd ("dwarf", class_maintenance, _("\
Set DWARF specific variables.\n\
Configure DWARF variables such as the cache size."),
- &set_dwarf_cmdlist, "maintenance set dwarf ",
+ &set_dwarf_cmdlist,
0/*allow-unknown*/, &maintenance_set_cmdlist);
add_show_prefix_cmd ("dwarf", class_maintenance, _("\
Show DWARF specific variables.\n\
Show DWARF variables such as the cache size."),
- &show_dwarf_cmdlist, "maintenance show dwarf ",
+ &show_dwarf_cmdlist,
0/*allow-unknown*/, &maintenance_show_cmdlist);
add_setshow_zinteger_cmd ("max-cache-age", class_obscure,
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 7e921b9..5731c40 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -1685,11 +1685,11 @@ _initialize_f_language ()
add_basic_prefix_cmd ("fortran", no_class,
_("Prefix command for changing Fortran-specific settings."),
- &set_fortran_list, "set fortran ", 0, &setlist);
+ &set_fortran_list, 0, &setlist);
add_show_prefix_cmd ("fortran", no_class,
_("Generic command for showing Fortran-specific settings."),
- &show_fortran_list, "show fortran ", 0, &showlist);
+ &show_fortran_list, 0, &showlist);
add_setshow_boolean_cmd ("repack-array-slices", class_vars,
&repack_array_slices, _("\
diff --git a/gdb/frame.c b/gdb/frame.c
index cd10f3f..d2e14c8 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -3171,12 +3171,12 @@ _initialize_frame ()
add_basic_prefix_cmd ("backtrace", class_maintenance, _("\
Set backtrace specific variables.\n\
Configure backtrace variables such as the backtrace limit"),
- &set_backtrace_cmdlist, "set backtrace ",
+ &set_backtrace_cmdlist,
0/*allow-unknown*/, &setlist);
add_show_prefix_cmd ("backtrace", class_maintenance, _("\
Show backtrace specific variables.\n\
Show backtrace variables such as the backtrace limit."),
- &show_backtrace_cmdlist, "show backtrace ",
+ &show_backtrace_cmdlist,
0/*allow-unknown*/, &showlist);
add_setshow_uinteger_cmd ("limit", class_obscure,
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 816f901..aadd3e8 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -3238,10 +3238,10 @@ Show whether exceptions in the inferior process will be trapped."),
add_prefix_cmd ("task", no_class, set_task_cmd,
_("Command prefix for setting task attributes."),
- &set_task_cmd_list, "set task ", 0, &setlist);
+ &set_task_cmd_list, 0, &setlist);
add_prefix_cmd ("task", no_class, show_task_cmd,
_("Command prefix for showing task attributes."),
- &show_task_cmd_list, "show task ", 0, &showlist);
+ &show_task_cmd_list, 0, &showlist);
add_cmd ("pause", class_run, set_task_pause_cmd, _("\
Set whether the task is suspended while gdb has control.\n\
@@ -3410,17 +3410,17 @@ add_thread_commands (void)
{
add_prefix_cmd ("thread", no_class, set_thread_cmd,
_("Command prefix for setting thread properties."),
- &set_thread_cmd_list, "set thread ", 0, &setlist);
+ &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, "set thread default ", 0,
+ &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, "show thread ", 0, &showlist);
+ &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, "show thread default ", 0,
+ &show_thread_default_cmd_list, 0,
&show_thread_cmd_list);
add_cmd ("pause", class_run, set_thread_pause_cmd, _("\
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index 9899545..5aae340 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -2099,7 +2099,7 @@ _initialize_go32_nat ()
add_basic_prefix_cmd ("dos", class_info, _("\
Print information specific to DJGPP (aka MS-DOS) debugging."),
- &info_dos_cmdlist, "info dos ", 0, &infolist);
+ &info_dos_cmdlist, 0, &infolist);
add_cmd ("sysinfo", class_info, go32_sysinfo, _("\
Display information about the target system, including CPU, OS, DPMI, etc."),
diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c
index 71d61f3..0166355 100644
--- a/gdb/guile/guile.c
+++ b/gdb/guile/guile.c
@@ -782,20 +782,17 @@ This command is only a placeholder.")
add_basic_prefix_cmd ("guile", class_obscure,
_("Prefix command for Guile preference settings."),
- &set_guile_list, "set guile ", 0,
- &setlist);
+ &set_guile_list, 0, &setlist);
add_alias_cmd ("gu", "guile", class_obscure, 1, &setlist);
add_show_prefix_cmd ("guile", class_obscure,
_("Prefix command for Guile preference settings."),
- &show_guile_list, "show guile ", 0,
- &showlist);
+ &show_guile_list, 0, &showlist);
add_alias_cmd ("gu", "guile", class_obscure, 1, &showlist);
add_basic_prefix_cmd ("guile", class_obscure,
_("Prefix command for Guile info displays."),
- &info_guile_list, "info guile ", 0,
- &infolist);
+ &info_guile_list, 0, &infolist);
add_info_alias ("gu", "guile", 1);
/* The name "print-stack" is carried over from Python.
diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c
index 1708d66..1f35d88 100644
--- a/gdb/guile/scm-cmd.c
+++ b/gdb/guile/scm-cmd.c
@@ -766,7 +766,7 @@ gdbscm_register_command_x (SCM self)
cmd = add_prefix_cmd (c_smob->cmd_name, c_smob->cmd_class,
NULL, c_smob->doc, &c_smob->sub_list,
- c_smob->name, allow_unknown, cmd_list);
+ allow_unknown, cmd_list);
}
else
{
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 50fd276..5e6769a 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -9031,14 +9031,14 @@ is \"default\"."),
add_basic_prefix_cmd ("mpx", class_support, _("\
Set Intel Memory Protection Extensions specific variables."),
- &mpx_set_cmdlist, "set mpx ",
+ &mpx_set_cmdlist,
0 /* allow-unknown */, &setlist);
/* Add "mpx" prefix for the show commands. */
add_show_prefix_cmd ("mpx", class_support, _("\
Show Intel Memory Protection Extensions specific variables."),
- &mpx_show_cmdlist, "show mpx ",
+ &mpx_show_cmdlist,
0 /* allow-unknown */, &showlist);
/* Add "bound" command for the show mpx commands list. */
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index f0b044d..a22d815 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -3084,7 +3084,7 @@ environment to be given to the program."), &showlist);
add_basic_prefix_cmd ("unset", no_class,
_("Complement to certain \"set\" commands."),
- &unsetlist, "unset ", 0, &cmdlist);
+ &unsetlist, 0, &cmdlist);
c = add_cmd ("environment", class_run, unset_environment_command, _("\
Cancel environment variable VAR for the program.\n\
@@ -3121,7 +3121,7 @@ needed."),
add_prefix_cmd ("kill", class_run, kill_command,
_("Kill execution of program being debugged."),
- &killlist, "kill ", 0, &cmdlist);
+ &killlist, 0, &cmdlist);
add_com ("attach", class_run, attach_command, _("\
Attach to a process or file outside of GDB.\n\
@@ -3140,7 +3140,7 @@ to specify the program, and to load its symbol table."));
Detach a process or file previously attached.\n\
If a process, it is no longer traced, and it continues its execution. If\n\
you were debugging a file, the file is closed and gdb no longer accesses it."),
- &detachlist, "detach ", 0, &cmdlist);
+ &detachlist, 0, &cmdlist);
add_com ("disconnect", class_run, disconnect_command, _("\
Disconnect from a target.\n\
@@ -3295,7 +3295,7 @@ in the named register groups."));
_("\
Show additional information about a process.\n\
Specify any process id, or use the program being debugged by default."),
- &info_proc_cmdlist, "info proc ",
+ &info_proc_cmdlist,
1/*allow-unknown*/, &infolist);
add_cmd ("mappings", class_info, info_proc_cmd_mappings, _("\
diff --git a/gdb/language.c b/gdb/language.c
index 4cb71d6..a3f96ec 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -1166,13 +1166,13 @@ _initialize_language ()
add_basic_prefix_cmd ("check", no_class,
_("Set the status of the type/range checker."),
- &setchecklist, "set check ", 0, &setlist);
+ &setchecklist, 0, &setlist);
add_alias_cmd ("c", "check", no_class, 1, &setlist);
add_alias_cmd ("ch", "check", no_class, 1, &setlist);
add_show_prefix_cmd ("check", no_class,
_("Show the status of the type/range checker."),
- &showchecklist, "show check ", 0, &showlist);
+ &showchecklist, 0, &showlist);
add_alias_cmd ("c", "check", no_class, 1, &showlist);
add_alias_cmd ("ch", "check", no_class, 1, &showlist);
diff --git a/gdb/macrocmd.c b/gdb/macrocmd.c
index d767926..4e4a68d 100644
--- a/gdb/macrocmd.c
+++ b/gdb/macrocmd.c
@@ -455,7 +455,7 @@ _initialize_macrocmd ()
the various commands for working with preprocessor macros. */
add_basic_prefix_cmd ("macro", class_info,
_("Prefix for commands dealing with C preprocessor macros."),
- &macrolist, "macro ", 0, &cmdlist);
+ &macrolist, 0, &cmdlist);
add_cmd ("expand", no_class, macro_expand_command, _("\
Fully expand any C/C++ preprocessor macro invocations in EXPRESSION.\n\
diff --git a/gdb/maint-test-options.c b/gdb/maint-test-options.c
index 16ecd1d..b773e75 100644
--- a/gdb/maint-test-options.c
+++ b/gdb/maint-test-options.c
@@ -422,8 +422,7 @@ _initialize_maint_test_options ()
_("\
Generic command for testing the options infrastructure."),
&maintenance_test_options_list,
- "maintenance test-options ", 0,
- &maintenancelist);
+ 0, &maintenancelist);
const auto def_group = make_test_options_options_def_group (nullptr);
diff --git a/gdb/maint-test-settings.c b/gdb/maint-test-settings.c
index ca28fcf..0ce8890 100644
--- a/gdb/maint-test-settings.c
+++ b/gdb/maint-test-settings.c
@@ -89,7 +89,6 @@ _initialize_maint_test_settings ()
_("\
Set GDB internal variables used for set/show command infrastructure testing."),
&maintenance_set_test_settings_list,
- "maintenance set test-settings ",
0/*allow-unknown*/,
&maintenance_set_cmdlist);
@@ -97,7 +96,6 @@ Set GDB internal variables used for set/show command infrastructure testing."),
_("\
Show GDB internal variables used for set/show command infrastructure testing."),
&maintenance_show_test_settings_list,
- "maintenance show test-settings ",
0/*allow-unknown*/,
&maintenance_show_cmdlist);
diff --git a/gdb/maint.c b/gdb/maint.c
index 7f505d0..154bef5 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -1137,14 +1137,14 @@ _initialize_maint_cmds ()
Commands for use by GDB maintainers.\n\
Includes commands to dump specific internal GDB structures in\n\
a human readable form, to cause GDB to deliberately dump core, etc."),
- &maintenancelist, "maintenance ", 0,
+ &maintenancelist, 0,
&cmdlist);
add_com_alias ("mt", "maintenance", class_maintenance, 1);
add_basic_prefix_cmd ("info", class_maintenance, _("\
Commands for showing internal info about the program being debugged."),
- &maintenanceinfolist, "maintenance info ", 0,
+ &maintenanceinfolist, 0,
&maintenancelist);
add_alias_cmd ("i", "info", class_maintenance, 1, &maintenancelist);
@@ -1183,25 +1183,25 @@ sectoins."),
add_basic_prefix_cmd ("print", class_maintenance,
_("Maintenance command for printing GDB internal state."),
- &maintenanceprintlist, "maintenance print ", 0,
+ &maintenanceprintlist, 0,
&maintenancelist);
add_basic_prefix_cmd ("flush", class_maintenance,
_("Maintenance command for flushing GDB internal caches."),
- &maintenanceflushlist, "maintenance flush ", 0,
+ &maintenanceflushlist, 0,
&maintenancelist);
add_basic_prefix_cmd ("set", class_maintenance, _("\
Set GDB internal variables used by the GDB maintainer.\n\
Configure variables internal to GDB that aid in GDB's maintenance"),
- &maintenance_set_cmdlist, "maintenance set ",
+ &maintenance_set_cmdlist,
0/*allow-unknown*/,
&maintenancelist);
add_show_prefix_cmd ("show", class_maintenance, _("\
Show GDB internal variables used by the GDB maintainer.\n\
Configure variables internal to GDB that aid in GDB's maintenance"),
- &maintenance_show_cmdlist, "maintenance show ",
+ &maintenance_show_cmdlist,
0/*allow-unknown*/,
&maintenancelist);
@@ -1247,12 +1247,12 @@ This command has been moved to \"demangle\"."),
add_prefix_cmd ("per-command", class_maintenance, set_per_command_cmd, _("\
Per-command statistics settings."),
- &per_command_setlist, "maintenance set per-command ",
+ &per_command_setlist,
1/*allow-unknown*/, &maintenance_set_cmdlist);
add_show_prefix_cmd ("per-command", class_maintenance, _("\
Show per-command statistics settings."),
- &per_command_showlist, "maintenance show per-command ",
+ &per_command_showlist,
0/*allow-unknown*/, &maintenance_show_cmdlist);
add_setshow_boolean_cmd ("time", class_maintenance,
@@ -1320,7 +1320,7 @@ Takes an optional file parameter."),
add_basic_prefix_cmd ("check", class_maintenance, _("\
Commands for checking internal gdb state."),
- &maintenancechecklist, "maintenance check ", 0,
+ &maintenancechecklist, 0,
&maintenancelist);
add_cmd ("translate-address", class_maintenance,
diff --git a/gdb/memattr.c b/gdb/memattr.c
index 17de583..e1c3931 100644
--- a/gdb/memattr.c
+++ b/gdb/memattr.c
@@ -625,11 +625,11 @@ Do \"info mem\" to see current list of IDs."), &deletelist);
add_basic_prefix_cmd ("mem", class_vars, _("\
Memory regions settings."),
- &mem_set_cmdlist, "set mem ",
+ &mem_set_cmdlist,
0/* allow-unknown */, &setlist);
add_show_prefix_cmd ("mem", class_vars, _("\
Memory regions settings."),
- &mem_show_cmdlist, "show mem ",
+ &mem_show_cmdlist,
0/* allow-unknown */, &showlist);
add_setshow_boolean_cmd ("inaccessible-by-default", no_class,
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 61545ae..2fe8332 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -8945,11 +8945,11 @@ _initialize_mips_tdep ()
/* Add root prefix command for all "set mips"/"show mips" commands. */
add_basic_prefix_cmd ("mips", no_class,
_("Various MIPS specific commands."),
- &setmipscmdlist, "set mips ", 0, &setlist);
+ &setmipscmdlist, 0, &setlist);
add_show_prefix_cmd ("mips", no_class,
_("Various MIPS specific commands."),
- &showmipscmdlist, "show mips ", 0, &showlist);
+ &showmipscmdlist, 0, &showlist);
/* Allow the user to override the ABI. */
add_setshow_enum_cmd ("abi", class_obscure, mips_abi_strings,
@@ -8990,7 +8990,7 @@ and is updated automatically from ELF file flags if available."),
add_basic_prefix_cmd ("mipsfpu", class_support,
_("Set use of MIPS floating-point coprocessor."),
- &mipsfpulist, "set mipsfpu ", 0, &setlist);
+ &mipsfpulist, 0, &setlist);
add_cmd ("single", class_support, set_mipsfpu_single_command,
_("Select single-precision MIPS floating-point coprocessor."),
&mipsfpulist);
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 1c68d19..a5c03c3 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -3281,7 +3281,7 @@ Use \"set variable\" for variables with names identical to set subcommands.\n\
\n\
With a subcommand, this command modifies parts of the gdb environment.\n\
You can see these environment settings with the \"show\" command."),
- &setlist, "set ", 1, &cmdlist);
+ &setlist, 1, &cmdlist);
if (dbx_commands)
add_com ("assign", class_vars, set_command, _("\
Evaluate expression EXP and assign result to variable VAR.\n\
@@ -3385,7 +3385,7 @@ treat this string as a command line, and evaluate it."));
/* Memory tagging commands. */
add_prefix_cmd ("memory-tag", class_vars, memory_tag_command, _("\
Generic command for printing and manipulating memory tag properties."),
- &memory_tag_list, "memory-tag ", 0, &cmdlist);
+ &memory_tag_list, 0, &cmdlist);
add_cmd ("print-logical-tag", class_vars,
memory_tag_print_logical_tag_command,
("Print the logical tag from POINTER.\n\
diff --git a/gdb/probe.c b/gdb/probe.c
index 0c4f22c..9eccf82 100644
--- a/gdb/probe.c
+++ b/gdb/probe.c
@@ -788,8 +788,7 @@ If you specify TYPE, there may be additional arguments needed by the\n\
subcommand.\n\
If you do not specify any argument, or specify `all', then the command\n\
will show information about all types of probes."),
- &info_probes_cmdlist, "info probes ",
- 0/*allow-unknown*/, &infolist);
+ &info_probes_cmdlist, 0/*allow-unknown*/, &infolist);
return &info_probes_cmdlist;
}
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index f4d3dcc..9833bf8 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -95,9 +95,6 @@ cmdpy_destroyer (struct cmd_list_element *self, void *context)
/* Release our hold on the command object. */
gdbpy_ref<cmdpy_object> cmd ((cmdpy_object *) context);
cmd->command = NULL;
-
- /* We may have allocated the prefix name. */
- xfree ((char *) self->prefixname);
}
/* Called by gdb to invoke the command. */
@@ -114,7 +111,7 @@ cmdpy_function (struct cmd_list_element *command,
error (_("Invalid invocation of Python command object."));
if (! PyObject_HasAttr ((PyObject *) obj, invoke_cst))
{
- if (obj->command->prefixname)
+ if (obj->command->prefixlist != nullptr)
{
/* A prefix command does not need an invoke method. */
return;
@@ -438,11 +435,11 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
int completetype = -1;
char *docstring = NULL;
struct cmd_list_element **cmd_list;
- char *cmd_name, *pfx_name;
+ char *cmd_name;
static const char *keywords[] = { "name", "command_class", "completer_class",
"prefix", NULL };
- PyObject *is_prefix = NULL;
- int cmp;
+ PyObject *is_prefix_obj = NULL;
+ bool is_prefix = false;
if (obj->command)
{
@@ -455,7 +452,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "si|iO",
keywords, &name, &cmdtype,
- &completetype, &is_prefix))
+ &completetype, &is_prefix_obj))
return -1;
if (cmdtype != no_class && cmdtype != class_run
@@ -481,39 +478,17 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
if (! cmd_name)
return -1;
- pfx_name = NULL;
- if (is_prefix != NULL)
+ if (is_prefix_obj != NULL)
{
- cmp = PyObject_IsTrue (is_prefix);
- if (cmp == 1)
- {
- int i, out;
-
- /* Make a normalized form of the command name. */
- pfx_name = (char *) xmalloc (strlen (name) + 2);
-
- i = 0;
- out = 0;
- while (name[i])
- {
- /* Skip whitespace. */
- while (name[i] == ' ' || name[i] == '\t')
- ++i;
- /* Copy non-whitespace characters. */
- while (name[i] && name[i] != ' ' && name[i] != '\t')
- pfx_name[out++] = name[i++];
- /* Add a single space after each word -- including the final
- word. */
- pfx_name[out++] = ' ';
- }
- pfx_name[out] = '\0';
- }
- else if (cmp < 0)
+ int cmp = PyObject_IsTrue (is_prefix_obj);
+ if (cmp < 0)
{
xfree (cmd_name);
return -1;
}
+ is_prefix = cmp > 0;
}
+
if (PyObject_HasAttr (self, gdbpy_doc_cst))
{
gdbpy_ref<> ds_obj (PyObject_GetAttr (self, gdbpy_doc_cst));
@@ -524,7 +499,6 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
if (docstring == NULL)
{
xfree (cmd_name);
- xfree (pfx_name);
return -1;
}
}
@@ -538,7 +512,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
{
struct cmd_list_element *cmd;
- if (pfx_name)
+ if (is_prefix)
{
int allow_unknown;
@@ -547,7 +521,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
allow_unknown = PyObject_HasAttr (self, invoke_cst);
cmd = add_prefix_cmd (cmd_name, (enum command_class) cmdtype,
NULL, docstring, &obj->sub_list,
- pfx_name, allow_unknown, cmd_list);
+ allow_unknown, cmd_list);
}
else
cmd = add_cmd (cmd_name, (enum command_class) cmdtype,
@@ -571,7 +545,6 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
{
xfree (cmd_name);
xfree (docstring);
- xfree (pfx_name);
gdbpy_convert_exception (except);
return -1;
}
diff --git a/gdb/python/python.c b/gdb/python/python.c
index c46d68b..4cea83c 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1936,13 +1936,11 @@ This command is only a placeholder.")
/* Add set/show python print-stack. */
add_basic_prefix_cmd ("python", no_class,
_("Prefix command for python preference settings."),
- &user_show_python_list, "show python ", 0,
- &showlist);
+ &user_show_python_list, 0, &showlist);
add_show_prefix_cmd ("python", no_class,
_("Prefix command for python preference settings."),
- &user_set_python_list, "set python ", 0,
- &setlist);
+ &user_set_python_list, 0, &setlist);
add_setshow_enum_cmd ("print-stack", no_class, python_excp_enums,
&gdbpy_should_print_stack, _("\
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 84a0390..490af3a 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -719,11 +719,11 @@ _initialize_ravenscar ()
add_basic_prefix_cmd ("ravenscar", no_class,
_("Prefix command for changing Ravenscar-specific settings."),
- &set_ravenscar_list, "set ravenscar ", 0, &setlist);
+ &set_ravenscar_list, 0, &setlist);
add_show_prefix_cmd ("ravenscar", no_class,
_("Prefix command for showing Ravenscar-specific settings."),
- &show_ravenscar_list, "show ravenscar ", 0, &showlist);
+ &show_ravenscar_list, 0, &showlist);
add_setshow_boolean_cmd ("task-switching", class_obscure,
&ravenscar_task_support, _("\
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index c888ad0..c04e1cd 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -3111,7 +3111,7 @@ _initialize_record_btrace ()
{
add_prefix_cmd ("btrace", class_obscure, cmd_record_btrace_start,
_("Start branch trace recording."), &record_btrace_cmdlist,
- "record btrace ", 0, &record_cmdlist);
+ 0, &record_cmdlist);
add_alias_cmd ("b", "btrace", class_obscure, 1, &record_cmdlist);
add_cmd ("bts", class_obscure, cmd_record_btrace_bts_start,
@@ -3131,11 +3131,11 @@ This format may not be available on all processors."),
add_basic_prefix_cmd ("btrace", class_support,
_("Set record options."), &set_record_btrace_cmdlist,
- "set record btrace ", 0, &set_record_cmdlist);
+ 0, &set_record_cmdlist);
add_show_prefix_cmd ("btrace", class_support,
_("Show record options."), &show_record_btrace_cmdlist,
- "show record btrace ", 0, &show_record_cmdlist);
+ 0, &show_record_cmdlist);
add_setshow_enum_cmd ("replay-memory-access", no_class,
replay_memory_access_types, &replay_memory_access, _("\
@@ -3163,7 +3163,7 @@ When GDB does not support that cpu, this option can be used to enable\n\
workarounds for a similar cpu that GDB supports.\n\n\
When set to \"none\", errata workarounds are disabled."),
&set_record_btrace_cpu_cmdlist,
- "set record btrace cpu ", 1,
+ 1,
&set_record_btrace_cmdlist);
add_cmd ("auto", class_support, cmd_set_record_btrace_cpu_auto, _("\
@@ -3181,13 +3181,13 @@ Show the cpu to be used for trace decode."),
add_basic_prefix_cmd ("bts", class_support,
_("Set record btrace bts options."),
&set_record_btrace_bts_cmdlist,
- "set record btrace bts ", 0,
+ 0,
&set_record_btrace_cmdlist);
add_show_prefix_cmd ("bts", class_support,
_("Show record btrace bts options."),
&show_record_btrace_bts_cmdlist,
- "show record btrace bts ", 0,
+ 0,
&show_record_btrace_cmdlist);
add_setshow_uinteger_cmd ("buffer-size", no_class,
@@ -3207,13 +3207,13 @@ The trace buffer size may not be changed while recording."), NULL,
add_basic_prefix_cmd ("pt", class_support,
_("Set record btrace pt options."),
&set_record_btrace_pt_cmdlist,
- "set record btrace pt ", 0,
+ 0,
&set_record_btrace_cmdlist);
add_show_prefix_cmd ("pt", class_support,
_("Show record btrace pt options."),
&show_record_btrace_pt_cmdlist,
- "show record btrace pt ", 0,
+ 0,
&show_record_btrace_cmdlist);
add_setshow_uinteger_cmd ("buffer-size", no_class,
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 8a035b2..91da107 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -2794,7 +2794,7 @@ _initialize_record_full ()
add_prefix_cmd ("full", class_obscure, cmd_record_full_start,
_("Start full execution recording."), &record_full_cmdlist,
- "record full ", 0, &record_cmdlist);
+ 0, &record_cmdlist);
c = add_cmd ("restore", class_obscure, cmd_record_full_restore,
_("Restore the execution log from a file.\n\
@@ -2810,11 +2810,11 @@ Argument is filename. File must be created with 'record save'."),
add_basic_prefix_cmd ("full", class_support,
_("Set record options."), &set_record_full_cmdlist,
- "set record full ", 0, &set_record_cmdlist);
+ 0, &set_record_cmdlist);
add_show_prefix_cmd ("full", class_support,
_("Show record options."), &show_record_full_cmdlist,
- "show record full ", 0, &show_record_cmdlist);
+ 0, &show_record_cmdlist);
/* Record instructions number limit command. */
add_setshow_boolean_cmd ("stop-at-limit", no_class,
diff --git a/gdb/record.c b/gdb/record.c
index 483b906..7dae18f 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -787,21 +787,21 @@ A size of \"unlimited\" means unlimited lines. The default is 10."),
c = add_prefix_cmd ("record", class_obscure, cmd_record_start,
_("Start recording."),
- &record_cmdlist, "record ", 0, &cmdlist);
+ &record_cmdlist, 0, &cmdlist);
set_cmd_completer (c, filename_completer);
add_com_alias ("rec", "record", class_obscure, 1);
add_basic_prefix_cmd ("record", class_support,
_("Set record options."), &set_record_cmdlist,
- "set record ", 0, &setlist);
+ 0, &setlist);
add_alias_cmd ("rec", "record", class_obscure, 1, &setlist);
add_show_prefix_cmd ("record", class_support,
_("Show record options."), &show_record_cmdlist,
- "show record ", 0, &showlist);
+ 0, &showlist);
add_alias_cmd ("rec", "record", class_obscure, 1, &showlist);
add_prefix_cmd ("record", class_support, info_record_command,
_("Info record options."), &info_record_cmdlist,
- "info record ", 0, &infolist);
+ 0, &infolist);
add_alias_cmd ("rec", "record", class_obscure, 1, &infolist);
c = add_cmd ("save", class_obscure, cmd_record_save,
@@ -825,7 +825,7 @@ Default filename is 'gdb_record.PROCESS_ID'."),
add_prefix_cmd ("goto", class_obscure, cmd_record_goto, _("\
Restore the program to its state at instruction number N.\n\
Argument is instruction number, as shown by 'info record'."),
- &record_goto_cmdlist, "record goto ", 1, &record_cmdlist);
+ &record_goto_cmdlist, 1, &record_cmdlist);
add_cmd ("begin", class_obscure, cmd_record_goto_begin,
_("Go to the beginning of the execution log."),
diff --git a/gdb/remote.c b/gdb/remote.c
index d3a6659..8411b29 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -14854,13 +14854,13 @@ _initialize_remote ()
Remote protocol specific variables.\n\
Configure various remote-protocol specific variables such as\n\
the packets being used."),
- &remote_set_cmdlist, "set remote ",
+ &remote_set_cmdlist,
0 /* allow-unknown */, &setlist);
add_prefix_cmd ("remote", class_maintenance, show_remote_cmd, _("\
Remote protocol specific variables.\n\
Configure various remote-protocol specific variables such as\n\
the packets being used."),
- &remote_show_cmdlist, "show remote ",
+ &remote_show_cmdlist,
0 /* allow-unknown */, &showlist);
add_cmd ("compare-sections", class_obscure, compare_sections_command, _("\
@@ -15282,7 +15282,7 @@ packets."),
add_basic_prefix_cmd ("remote", class_files, _("\
Manipulate files on the remote system.\n\
Transfer files to and from the remote target system."),
- &remote_cmdlist, "remote ",
+ &remote_cmdlist,
0 /* allow-unknown */, &cmdlist);
add_cmd ("put", class_files, remote_put_command,
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index c178399..7fae914 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -3850,12 +3850,12 @@ _initialize_riscv_tdep ()
riscv" commands. */
add_basic_prefix_cmd ("riscv", no_class,
_("RISC-V specific debug commands."),
- &setdebugriscvcmdlist, "set debug riscv ", 0,
+ &setdebugriscvcmdlist, 0,
&setdebuglist);
add_show_prefix_cmd ("riscv", no_class,
_("RISC-V specific debug commands."),
- &showdebugriscvcmdlist, "show debug riscv ", 0,
+ &showdebugriscvcmdlist, 0,
&showdebuglist);
add_setshow_zuinteger_cmd ("breakpoints", class_maintenance,
@@ -3901,11 +3901,11 @@ initialisation process."),
/* Add root prefix command for all "set riscv" and "show riscv" commands. */
add_basic_prefix_cmd ("riscv", no_class,
_("RISC-V specific commands."),
- &setriscvcmdlist, "set riscv ", 0, &setlist);
+ &setriscvcmdlist, 0, &setlist);
add_show_prefix_cmd ("riscv", no_class,
_("RISC-V specific commands."),
- &showriscvcmdlist, "show riscv ", 0, &showlist);
+ &showriscvcmdlist, 0, &showlist);
use_compressed_breakpoints = AUTO_BOOLEAN_AUTO;
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 347014d..57dbe5b 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -7402,11 +7402,11 @@ _initialize_rs6000_tdep ()
commands. */
add_basic_prefix_cmd ("powerpc", no_class,
_("Various PowerPC-specific commands."),
- &setpowerpccmdlist, "set powerpc ", 0, &setlist);
+ &setpowerpccmdlist, 0, &setlist);
add_show_prefix_cmd ("powerpc", no_class,
_("Various PowerPC-specific commands."),
- &showpowerpccmdlist, "show powerpc ", 0, &showlist);
+ &showpowerpccmdlist, 0, &showlist);
/* Add a command to allow the user to force the ABI. */
add_setshow_auto_boolean_cmd ("soft-float", class_support,
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index e79c9e6..2519caa 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -469,12 +469,12 @@ _initialize_ser_tcp ()
add_basic_prefix_cmd ("tcp", class_maintenance, _("\
TCP protocol specific variables.\n\
Configure variables specific to remote TCP connections."),
- &tcp_set_cmdlist, "set tcp ",
+ &tcp_set_cmdlist,
0 /* allow-unknown */, &setlist);
add_show_prefix_cmd ("tcp", class_maintenance, _("\
TCP protocol specific variables.\n\
Configure variables specific to remote TCP connections."),
- &tcp_show_cmdlist, "show tcp ",
+ &tcp_show_cmdlist,
0 /* allow-unknown */, &showlist);
add_setshow_boolean_cmd ("auto-retry", class_obscure,
diff --git a/gdb/serial.c b/gdb/serial.c
index 1854721..719cd66 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -671,13 +671,13 @@ Use <CR>~. or <CR>~^D to break out."));
add_basic_prefix_cmd ("serial", class_maintenance, _("\
Set default serial/parallel port configuration."),
- &serial_set_cmdlist, "set serial ",
+ &serial_set_cmdlist,
0/*allow-unknown*/,
&setlist);
add_show_prefix_cmd ("serial", class_maintenance, _("\
Show default serial/parallel port configuration."),
- &serial_show_cmdlist, "show serial ",
+ &serial_show_cmdlist,
0/*allow-unknown*/,
&showlist);
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 5a71d3a..31d912d 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -2415,9 +2415,9 @@ _initialize_sh_tdep ()
gdbarch_register (bfd_arch_sh, sh_gdbarch_init, NULL);
add_basic_prefix_cmd ("sh", no_class, "SH specific commands.",
- &setshcmdlist, "set sh ", 0, &setlist);
+ &setshcmdlist, 0, &setlist);
add_show_prefix_cmd ("sh", no_class, "SH specific commands.",
- &showshcmdlist, "show sh ", 0, &showlist);
+ &showshcmdlist, 0, &showlist);
add_setshow_enum_cmd ("calling-convention", class_vars, sh_cc_enum,
&sh_active_calling_convention,
diff --git a/gdb/skip.c b/gdb/skip.c
index eeb5715..4d24088 100644
--- a/gdb/skip.c
+++ b/gdb/skip.c
@@ -676,7 +676,7 @@ FILE-SPEC is one of:\n\
FUNCTION-SPEC is one of:\n\
-fu|-function FUNCTION-NAME\n\
-rfu|-rfunction FUNCTION-NAME-REGULAR-EXPRESSION"),
- &skiplist, "skip ", 1, &cmdlist);
+ &skiplist, 1, &cmdlist);
c = add_cmd ("file", class_breakpoint, skip_file_command, _("\
Ignore a file while stepping.\n\
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index 3609794..3f9600f 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -534,7 +534,7 @@ _initialize_sparc64_adi_tdep ()
{
add_basic_prefix_cmd ("adi", class_support,
_("ADI version related commands."),
- &sparc64adilist, "adi ", 0, &cmdlist);
+ &sparc64adilist, 0, &cmdlist);
add_cmd ("examine", class_support, adi_examine_command,
_("Examine ADI versions."), &sparc64adilist);
add_alias_cmd ("x", "examine", no_class, 1, &sparc64adilist);
diff --git a/gdb/stack.c b/gdb/stack.c
index bce6a2f..7856a5a 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -3343,7 +3343,7 @@ This is useful in command scripts."));
Select and print a stack frame.\n\
With no argument, print the selected stack frame. (See also \"info frame\").\n\
A single numerical argument specifies the frame to select."),
- &frame_cmd_list, "frame ", 1, &cmdlist);
+ &frame_cmd_list, 1, &cmdlist);
add_com_alias ("f", "frame", class_stack, 1);
#define FRAME_APPLY_OPTION_HELP "\
@@ -3367,7 +3367,7 @@ With a negative COUNT argument, applies the command on outermost -COUNT frames.\
cmd = add_prefix_cmd ("apply", class_stack, frame_apply_command,
frame_apply_cmd_help.c_str (),
- &frame_apply_cmd_list, "frame apply ", 1,
+ &frame_apply_cmd_list, 1,
&frame_cmd_list);
set_cmd_completer_handle_brkchars (cmd, frame_apply_cmd_completer);
@@ -3440,7 +3440,7 @@ Usage: frame level LEVEL"),
&select_frame_cmd.base_command, _("\
Select a stack frame without printing anything.\n\
A single numerical argument specifies the frame to select."),
- &select_frame_cmd_list, "select-frame ", 1, &cmdlist,
+ &select_frame_cmd_list, 1, &cmdlist,
&cli_suppress_notification.user_selected_context);
add_cmd_suppress_notification ("address", class_stack,
@@ -3515,7 +3515,7 @@ With a negative COUNT, print outermost -COUNT frames."),
With no arguments, displays information about the currently selected stack\n\
frame. Alternatively a frame specification may be provided (See \"frame\")\n\
the information is then printed about the specified frame."),
- &info_frame_cmd_list, "info frame ", 1, &infolist);
+ &info_frame_cmd_list, 1, &infolist);
add_info_alias ("f", "frame", 1);
add_cmd ("address", class_stack, &info_frame_cmd.address,
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 5defc22..4ba6953 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -3865,7 +3865,7 @@ on its own."), &cmdlist);
add_basic_prefix_cmd ("overlay", class_support,
_("Commands for debugging overlays."), &overlaylist,
- "overlay ", 0, &cmdlist);
+ 0, &cmdlist);
add_com_alias ("ovly", "overlay", class_support, 1);
add_com_alias ("ov", "overlay", class_support, 1);
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 061177e..9555f94 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -6799,8 +6799,7 @@ Options:\n\
add_basic_prefix_cmd ("module", class_info, _("\
Print information about modules."),
- &info_module_cmdlist, "info module ",
- 0, &infolist);
+ &info_module_cmdlist, 0, &infolist);
c = add_cmd ("functions", class_info, info_module_functions_command, _("\
Display functions arranged by modules.\n\
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 053864d..f7d0a68 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -1966,15 +1966,15 @@ _initialize_target_descriptions ()
add_basic_prefix_cmd ("tdesc", class_maintenance, _("\
Set target description specific variables."),
- &tdesc_set_cmdlist, "set tdesc ",
+ &tdesc_set_cmdlist,
0 /* allow-unknown */, &setlist);
add_show_prefix_cmd ("tdesc", class_maintenance, _("\
Show target description specific variables."),
- &tdesc_show_cmdlist, "show tdesc ",
+ &tdesc_show_cmdlist,
0 /* allow-unknown */, &showlist);
add_basic_prefix_cmd ("tdesc", class_maintenance, _("\
Unset target description specific variables."),
- &tdesc_unset_cmdlist, "unset tdesc ",
+ &tdesc_unset_cmdlist,
0 /* allow-unknown */, &unsetlist);
add_setshow_filename_cmd ("filename", class_obscure,
diff --git a/gdb/target.c b/gdb/target.c
index 78327a2..438788e 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -872,7 +872,7 @@ The first argument is the type or protocol of the target machine.\n\
Remaining arguments are interpreted by the target protocol. For more\n\
information on the arguments for a particular protocol, type\n\
`help target ' followed by the protocol name."),
- &targetlist, "target ", 0, &cmdlist);
+ &targetlist, 0, &cmdlist);
c = add_cmd (t.shortname, no_class, t.doc, &targetlist);
set_cmd_context (c, (void *) &t);
set_cmd_sfunc (c, open_target);
diff --git a/gdb/thread.c b/gdb/thread.c
index fc6db96..3cd588e 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -2137,7 +2137,7 @@ Options:\n\
add_prefix_cmd ("thread", class_run, thread_command, _("\
Use this command to switch between threads.\n\
The new thread ID must be currently known."),
- &thread_cmd_list, "thread ", 1, &cmdlist);
+ &thread_cmd_list, 1, &cmdlist);
#define THREAD_APPLY_OPTION_HELP "\
Prints per-inferior thread number and target system's thread id\n\
@@ -2160,7 +2160,7 @@ THREAD_APPLY_OPTION_HELP),
c = add_prefix_cmd ("apply", class_run, thread_apply_command,
thread_apply_help.c_str (),
- &thread_apply_list, "thread apply ", 1,
+ &thread_apply_list, 1,
&thread_cmd_list);
set_cmd_completer_handle_brkchars (c, thread_apply_command_completer);
diff --git a/gdb/top.c b/gdb/top.c
index a83d16b..2eb68fd 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -653,10 +653,14 @@ execute_command (const char *p, int from_tty)
that can be followed by its args), report the list of
subcommands. */
{
+ std::string prefixname = c->prefixname ();
+ std::string prefixname_no_space
+ = prefixname.substr (0, prefixname.length () - 1);
printf_unfiltered
- ("\"%.*s\" must be followed by the name of a subcommand.\n",
- (int) strlen (c->prefixname) - 1, c->prefixname);
- help_list (*c->prefixlist, c->prefixname, all_commands, gdb_stdout);
+ ("\"%s\" must be followed by the name of a subcommand.\n",
+ prefixname_no_space.c_str ());
+ help_list (*c->prefixlist, prefixname.c_str (), all_commands,
+ gdb_stdout);
}
else if (c->type == set_cmd)
do_set_command (arg, from_tty, c);
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 48d72d6..7f6d3e4 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -4046,7 +4046,7 @@ List target static tracepoints markers."));
add_prefix_cmd ("tfind", class_trace, tfind_command, _("\
Select a trace frame.\n\
No argument means forward by one frame; '-' means backward by one frame."),
- &tfindlist, "tfind ", 1, &cmdlist);
+ &tfindlist, 1, &cmdlist);
add_cmd ("outside", class_trace, tfind_outside_command, _("\
Select a trace frame whose PC is outside the given range (exclusive).\n\
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index bf9c3ff..b54e748 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -1022,7 +1022,7 @@ _initialize_tui_layout ()
add_basic_prefix_cmd ("layout", class_tui, _("\
Change the layout of windows.\n\
Usage: layout prev | next | LAYOUT-NAME"),
- &layout_list, "layout ", 0, &cmdlist);
+ &layout_list, 0, &cmdlist);
add_cmd ("next", class_tui, tui_next_layout_command,
_("Apply the next TUI layout."),
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 17682b0..f036127 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -306,7 +306,7 @@ tui_get_cmd_list (void)
if (tuilist == 0)
add_basic_prefix_cmd ("tui", class_tui,
_("Text User Interface commands."),
- &tuilist, "tui ", 0, &cmdlist);
+ &tuilist, 0, &cmdlist);
return &tuilist;
}
@@ -996,12 +996,10 @@ _initialize_tui_win ()
They will appear in the help list in the reverse of this order. */
add_basic_prefix_cmd ("tui", class_tui,
_("TUI configuration variables."),
- &tui_setlist, "set tui ",
- 0 /* allow-unknown */, &setlist);
+ &tui_setlist, 0 /* allow-unknown */, &setlist);
add_show_prefix_cmd ("tui", class_tui,
_("TUI configuration variables."),
- &tui_showlist, "show tui ",
- 0 /* allow-unknown */, &showlist);
+ &tui_showlist, 0 /* allow-unknown */, &showlist);
add_com ("refresh", class_tui, tui_refresh_all_command,
_("Refresh the terminal display."));
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index eb47d91..0776f63 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -847,12 +847,10 @@ Only one level of typedefs is unrolled. See also \"ptype\"."));
add_show_prefix_cmd ("type", no_class,
_("Generic command for showing type-printing settings."),
- &showprinttypelist, "show print type ", 0,
- &showprintlist);
+ &showprinttypelist, 0, &showprintlist);
add_basic_prefix_cmd ("type", no_class,
_("Generic command for setting how types print."),
- &setprinttypelist, "set print type ", 0,
- &setprintlist);
+ &setprinttypelist, 0, &setprintlist);
add_setshow_boolean_cmd ("methods", no_class, &print_methods,
_("\
diff --git a/gdb/unittests/command-def-selftests.c b/gdb/unittests/command-def-selftests.c
index e6aadf3..040e22b 100644
--- a/gdb/unittests/command-def-selftests.c
+++ b/gdb/unittests/command-def-selftests.c
@@ -87,7 +87,7 @@ check_doc (struct cmd_list_element *commandlist, const char *prefix)
{
/* Recursively call ourselves on the subcommand list,
passing the right prefix in. */
- check_doc (*c->prefixlist, c->prefixname);
+ check_doc (*c->prefixlist, c->prefixname ().c_str ());
}
}
}
@@ -159,7 +159,7 @@ traverse_command_structure (struct cmd_list_element **list,
{
/* Recursively call ourselves on the subcommand list,
passing the right prefix in. */
- traverse_command_structure (c->prefixlist, c->prefixname);
+ traverse_command_structure (c->prefixlist, c->prefixname ().c_str ());
}
if (prefixcmd != c->prefix
|| (prefixcmd == nullptr && *list != cmdlist))
diff --git a/gdb/utils.c b/gdb/utils.c
index 1f48a5a..c59c635 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -506,14 +506,10 @@ add_internal_problem_command (struct internal_problem *problem)
add_basic_prefix_cmd (problem->name, class_maintenance, set_doc,
set_cmd_list,
- concat ("maintenance set ", problem->name, " ",
- (char *) NULL),
0/*allow-unknown*/, &maintenance_set_cmdlist);
add_show_prefix_cmd (problem->name, class_maintenance, show_doc,
show_cmd_list,
- concat ("maintenance show ", problem->name, " ",
- (char *) NULL),
0/*allow-unknown*/, &maintenance_show_cmdlist);
if (problem->user_settable_should_quit)
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 654552a..e191c35 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -3145,28 +3145,26 @@ _initialize_valprint ()
add_basic_prefix_cmd ("print", no_class,
_("Generic command for setting how things print."),
- &setprintlist, "set print ", 0, &setlist);
+ &setprintlist, 0, &setlist);
add_alias_cmd ("p", "print", no_class, 1, &setlist);
/* Prefer set print to set prompt. */
add_alias_cmd ("pr", "print", no_class, 1, &setlist);
add_show_prefix_cmd ("print", no_class,
_("Generic command for showing print settings."),
- &showprintlist, "show print ", 0, &showlist);
+ &showprintlist, 0, &showlist);
add_alias_cmd ("p", "print", no_class, 1, &showlist);
add_alias_cmd ("pr", "print", no_class, 1, &showlist);
cmd = add_basic_prefix_cmd ("raw", no_class,
_("\
Generic command for setting what things to print in \"raw\" mode."),
- &setprintrawlist, "set print raw ", 0,
- &setprintlist);
+ &setprintrawlist, 0, &setprintlist);
deprecate_cmd (cmd, nullptr);
cmd = add_show_prefix_cmd ("raw", no_class,
_("Generic command for showing \"print raw\" settings."),
- &showprintrawlist, "show print raw ", 0,
- &showprintlist);
+ &showprintrawlist, 0, &showprintlist);
deprecate_cmd (cmd, nullptr);
gdb::option::add_setshow_cmds_for_options
diff --git a/gdb/value.c b/gdb/value.c
index 3bd81e7..9822cec 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -4259,7 +4259,7 @@ VARIABLE is already initialized."));
add_prefix_cmd ("function", no_class, function_command, _("\
Placeholder command for showing help on convenience functions."),
- &functionlist, "function ", 0, &cmdlist);
+ &functionlist, 0, &cmdlist);
add_internal_function ("_isvoid", _("\
Check whether an expression is void.\n\
diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index 97aa3da..e664484 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -616,7 +616,7 @@ init_w32_command_list (void)
add_basic_prefix_cmd
("w32", class_info,
_("Print information specific to Win32 debugging."),
- &info_w32_cmdlist, "info w32 ", 0, &infolist);
+ &info_w32_cmdlist, 0, &infolist);
w32_prefix_command_valid = 1;
}
}