/* Make sure to return to the directory GDB thinks it is, in case
the shell command we just ran changed it. */
chdir (current_directory);
- exit_status_set_internal_vars (rc);
#endif
+ exit_status_set_internal_vars (rc);
#else /* Can fork. */
int status, pid;
/* ALIAS must not exist. */
std::string alias_string (argv_to_string (alias_argv, alias_argc));
alias = alias_string.c_str ();
- if (valid_command_p (alias))
- error (_("Alias already exists: %s"), alias);
+ {
+ cmd_list_element *alias_cmd, *prefix_cmd, *cmd;
+
+ if (lookup_cmd_composition (alias, &alias_cmd, &prefix_cmd, &cmd))
+ {
+ const char *alias_name = alias_argv[alias_argc-1];
+
+ /* If we found an existing ALIAS_CMD, check that the prefix differ or
+ the name differ. */
+
+ if (alias_cmd != nullptr
+ && alias_cmd->prefix == prefix_cmd
+ && strcmp (alias_name, alias_cmd->name) == 0)
+ error (_("Alias already exists: %s"), alias);
+
+ /* Check ALIAS differs from the found CMD. */
+
+ if (cmd->prefix == prefix_cmd
+ && strcmp (alias_name, cmd->name) == 0)
+ error (_("Alias %s is the name of an existing command"), alias);
+ }
+ }
+
/* If ALIAS is one word, it is an alias for the entire COMMAND.
Example: alias spe = set print elements
When the program being debugged stops, gdb selects the innermost frame.\n\
The commands below can be used to select other frames by number or address."),
&cmdlist);
+#ifdef TUI
+ add_cmd ("text-user-interface", class_tui,
+ _("TUI is the GDB text based interface.\n\
+In TUI mode, GDB can display several text windows showing\n\
+the source file, the processor registers, the program disassembly, ..."), &cmdlist);
+#endif
add_cmd ("running", class_run, _("Running the program."), &cmdlist);
/* Define general commands. */
add_com ("complete", class_obscure, complete_command,
_("List the completions for the rest of the line as a command."));
- add_show_prefix_cmd ("show", class_info, _("\
+ c = add_show_prefix_cmd ("show", class_info, _("\
Generic command for showing things about the debugger."),
- &showlist, "show ", 0, &cmdlist);
+ &showlist, "show ", 0, &cmdlist);
/* Another way to get at the same thing. */
- add_show_prefix_cmd ("set", class_info, _("Show all GDB settings."),
- &showlist, "info set ", 0, &infolist);
+ add_alias_cmd ("set", c, class_info, 0, &infolist);
c = add_com ("with", class_vars, with_command, _("\
Temporarily set SETTING to VALUE, run COMMAND, and restore SETTING.\n\
ALIAS is the name of the alias command to create.\n\
COMMAND is the command being aliased to.\n\
If \"-a\" is specified, the command is an abbreviation,\n\
-and will not appear in help command list output.\n\
+and will not be used in command completion.\n\
\n\
Examples:\n\
Make \"spe\" an alias of \"set print elements\":\n\