+2021-05-27 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * command.h (add_com_alias): Accept target as
+ cmd_list_element. Update callers.
+
2021-05-27 Simon Marchi <simon.marchi@polymtl.ca>
* python/py-param.c (add_setshow_generic): Use return values of
BREAK_ARGS_HELP ("thbreak")));
set_cmd_completer (c, location_completer);
- add_prefix_cmd ("enable", class_breakpoint, enable_command, _("\
+ cmd_list_element *enable_cmd
+ = add_prefix_cmd ("enable", class_breakpoint, enable_command, _("\
Enable all or some breakpoints.\n\
Usage: enable [BREAKPOINTNUM]...\n\
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, 1, &cmdlist);
+ &enablelist, 1, &cmdlist);
- add_com_alias ("en", "enable", class_breakpoint, 1);
+ add_com_alias ("en", enable_cmd, class_breakpoint, 1);
add_prefix_cmd ("breakpoints", class_breakpoint, enable_command, _("\
Enable all or some breakpoints.\n\
the count is decremented; when it reaches zero, the breakpoint is disabled."),
&enablelist);
- add_prefix_cmd ("disable", class_breakpoint, disable_command, _("\
+ cmd_list_element *disable_cmd
+ = add_prefix_cmd ("disable", class_breakpoint, disable_command, _("\
Disable all or some breakpoints.\n\
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, 1, &cmdlist);
- add_com_alias ("dis", "disable", class_breakpoint, 1);
- add_com_alias ("disa", "disable", class_breakpoint, 1);
+ &disablelist, 1, &cmdlist);
+ add_com_alias ("dis", disable_cmd, class_breakpoint, 1);
+ add_com_alias ("disa", disable_cmd, class_breakpoint, 1);
add_cmd ("breakpoints", class_breakpoint, disable_command, _("\
Disable all or some breakpoints.\n\
This command may be abbreviated \"disable\"."),
&disablelist);
- add_prefix_cmd ("delete", class_breakpoint, delete_command, _("\
+ cmd_list_element *delete_cmd
+ = add_prefix_cmd ("delete", class_breakpoint, delete_command, _("\
Delete all or some breakpoints.\n\
Usage: delete [BREAKPOINTNUM]...\n\
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, 1, &cmdlist);
- add_com_alias ("d", "delete", class_breakpoint, 1);
- add_com_alias ("del", "delete", class_breakpoint, 1);
+ &deletelist, 1, &cmdlist);
+ add_com_alias ("d", delete_cmd, class_breakpoint, 1);
+ add_com_alias ("del", delete_cmd, class_breakpoint, 1);
add_cmd ("breakpoints", class_breakpoint, delete_command, _("\
Delete all or some breakpoints or auto-display expressions.\n\
This command may be abbreviated \"delete\"."),
&deletelist);
- add_com ("clear", class_breakpoint, clear_command, _("\
+ cmd_list_element *clear_cmd
+ = add_com ("clear", class_breakpoint, clear_command, _("\
Clear breakpoint at specified location.\n\
Argument may be a linespec, explicit, or address location as described below.\n\
\n\
is executing in.\n"
"\n" LOCATION_HELP_STRING "\n\n\
See also the \"delete\" command which clears breakpoints by number."));
- add_com_alias ("cl", "clear", class_breakpoint, 1);
+ add_com_alias ("cl", clear_cmd, class_breakpoint, 1);
- c = add_com ("break", class_breakpoint, break_command, _("\
+ cmd_list_element *break_cmd
+ = add_com ("break", class_breakpoint, break_command, _("\
Set breakpoint at specified location.\n"
BREAK_ARGS_HELP ("break")));
- set_cmd_completer (c, location_completer);
+ set_cmd_completer (break_cmd, location_completer);
- add_com_alias ("b", "break", class_run, 1);
- add_com_alias ("br", "break", class_run, 1);
- add_com_alias ("bre", "break", class_run, 1);
- add_com_alias ("brea", "break", class_run, 1);
+ add_com_alias ("b", break_cmd, class_run, 1);
+ add_com_alias ("br", break_cmd, class_run, 1);
+ add_com_alias ("bre", break_cmd, class_run, 1);
+ add_com_alias ("brea", break_cmd, class_run, 1);
if (dbx_commands)
{
/* Tracepoint manipulation commands. */
- c = add_com ("trace", class_breakpoint, trace_command, _("\
+ cmd_list_element *trace_cmd
+ = add_com ("trace", class_breakpoint, trace_command, _("\
Set a tracepoint at specified location.\n\
\n"
BREAK_ARGS_HELP ("trace") "\n\
Do \"help tracepoints\" for info on other tracepoint commands."));
- set_cmd_completer (c, location_completer);
+ set_cmd_completer (trace_cmd, location_completer);
- add_com_alias ("tp", "trace", class_breakpoint, 0);
- add_com_alias ("tr", "trace", class_breakpoint, 1);
- add_com_alias ("tra", "trace", class_breakpoint, 1);
- add_com_alias ("trac", "trace", class_breakpoint, 1);
+ add_com_alias ("tp", trace_cmd, class_breakpoint, 0);
+ add_com_alias ("tr", trace_cmd, class_breakpoint, 1);
+ add_com_alias ("tra", trace_cmd, class_breakpoint, 1);
+ add_com_alias ("trac", trace_cmd, class_breakpoint, 1);
c = add_com ("ftrace", class_breakpoint, ftrace_command, _("\
Set a fast tracepoint at specified location.\n\
&save_cmdlist);
set_cmd_completer (c, filename_completer);
- c = add_cmd ("tracepoints", class_trace, save_tracepoints_command, _("\
+ cmd_list_element *save_tracepoints_cmd
+ = add_cmd ("tracepoints", class_trace, save_tracepoints_command, _("\
Save current tracepoint definitions as a script.\n\
Use the 'source' command in another debug session to restore them."),
&save_cmdlist);
- set_cmd_completer (c, filename_completer);
+ set_cmd_completer (save_tracepoints_cmd, filename_completer);
- c = add_com_alias ("save-tracepoints", "save tracepoints", class_trace, 0);
+ c = add_com_alias ("save-tracepoints", save_tracepoints_cmd, class_trace, 0);
deprecate_cmd (c, "save tracepoints");
add_basic_prefix_cmd ("breakpoint", class_maintenance, _("\
and the user would expect bbb to execute 'backtrace -full -past-main'
while it will execute 'backtrace -past-main'. */
-static void
+static cmd_list_element *
validate_aliased_command (const char *command)
{
- struct cmd_list_element *c;
std::string default_args;
-
- c = lookup_cmd_1 (& command, cmdlist, NULL, &default_args, 1);
+ cmd_list_element *c
+ = lookup_cmd_1 (& command, cmdlist, NULL, &default_args, 1);
if (c == NULL || c == (struct cmd_list_element *) -1)
error (_("Invalid command to alias to: %s"), command);
if (!default_args.empty ())
error (_("Cannot define an alias of an alias that has default args"));
+
+ return c;
}
/* Called when "alias" was incorrectly used. */
std::string command_string (argv_to_string (command_argv.get (),
command_argc));
command = command_string.c_str ();
- validate_aliased_command (command);
+ cmd_list_element *target_cmd = validate_aliased_command (command);
/* ALIAS must not exist. */
std::string alias_string (argv_to_string (alias_argv, alias_argc));
if (alias_argc == 1)
{
/* add_cmd requires *we* allocate space for name, hence the xstrdup. */
- alias_cmd = add_com_alias (xstrdup (alias_argv[0]), command, class_alias,
- a_opts.abbrev_flag);
+ alias_cmd = add_com_alias (xstrdup (alias_argv[0]), target_cmd,
+ class_alias, a_opts.abbrev_flag);
}
else
{
show_script_ext_mode,
&setlist, &showlist);
- add_com ("quit", class_support, quit_command, _("\
+ cmd_list_element *quit_cmd
+ = add_com ("quit", class_support, quit_command, _("\
Exit gdb.\n\
Usage: quit [EXPR]\n\
The optional expression EXPR, if present, is evaluated and the result\n\
used as GDB's exit code. The default is zero."));
- c = add_com ("help", class_support, help_command,
+ cmd_list_element *help_cmd
+ = add_com ("help", class_support, help_command,
_("Print list of commands."));
- set_cmd_completer (c, command_completer);
- add_com_alias ("q", "quit", class_support, 1);
- add_com_alias ("h", "help", class_support, 1);
+ set_cmd_completer (help_cmd, command_completer);
+ add_com_alias ("q", quit_cmd, class_support, 1);
+ add_com_alias ("h", help_cmd, class_support, 1);
add_setshow_boolean_cmd ("verbose", class_support, &info_verbose, _("\
Set verbosity."), _("\
show_history_expansion_p,
&sethistlist, &showhistlist);
- add_prefix_cmd ("info", class_info, info_command, _("\
+ cmd_list_element *info_cmd
+ = add_prefix_cmd ("info", class_info, info_command, _("\
Generic command for showing things about the program being debugged."),
- &infolist, 0, &cmdlist);
- add_com_alias ("i", "info", class_info, 1);
- add_com_alias ("inf", "info", class_info, 1);
+ &infolist, 0, &cmdlist);
+ add_com_alias ("i", info_cmd, class_info, 1);
+ add_com_alias ("inf", info_cmd, class_info, 1);
add_com ("complete", class_obscure, complete_command,
_("List the completions for the rest of the line as a command."));
/* Another way to get at the same thing. */
add_alias_cmd ("set", c, class_info, 0, &infolist);
- c = add_com ("with", class_vars, with_command, _("\
+ cmd_list_element *with_cmd
+ = add_com ("with", class_vars, with_command, _("\
Temporarily set SETTING to VALUE, run COMMAND, and restore SETTING.\n\
Usage: with SETTING [VALUE] [-- COMMAND]\n\
Usage: w SETTING [VALUE] [-- COMMAND]\n\
You can change multiple settings using nested with, and use\n\
abbreviations for commands and/or values. E.g.:\n\
w la p -- w p el u -- p obj"));
- set_cmd_completer_handle_brkchars (c, with_command_completer);
- add_com_alias ("w", "with", class_vars, 1);
+ set_cmd_completer_handle_brkchars (with_cmd, with_command_completer);
+ add_com_alias ("w", with_cmd, class_vars, 1);
add_internal_function ("_gdb_setting_str", _("\
$_gdb_setting_str - returns the value of a GDB setting as a string.\n\
_("Generic command for showing gdb debugging flags."),
&showdebuglist, 0, &showlist);
- c = add_com ("shell", class_support, shell_command, _("\
+ cmd_list_element *shell_cmd
+ = add_com ("shell", class_support, shell_command, _("\
Execute the rest of the line as a shell command.\n\
With no arguments, run an inferior shell."));
- set_cmd_completer (c, filename_completer);
+ set_cmd_completer (shell_cmd, filename_completer);
- add_com_alias ("!", "shell", class_support, 0);
+ add_com_alias ("!", shell_cmd, class_support, 0);
c = add_com ("edit", class_files, edit_command, _("\
Edit specified file or function.\n\
c->completer = location_completer;
- c = add_com ("pipe", class_support, pipe_command, _("\
+ cmd_list_element *pipe_cmd
+ = add_com ("pipe", class_support, pipe_command, _("\
Send the output of a gdb command to a shell command.\n\
Usage: | [COMMAND] | SHELL_COMMAND\n\
Usage: | -d DELIM COMMAND DELIM SHELL_COMMAND\n\
\n\
With no COMMAND, repeat the last executed command\n\
and send its output to SHELL_COMMAND."));
- set_cmd_completer_handle_brkchars (c, pipe_command_completer);
- add_com_alias ("|", "pipe", class_support, 0);
+ set_cmd_completer_handle_brkchars (pipe_cmd, pipe_command_completer);
+ add_com_alias ("|", pipe_cmd, class_support, 0);
- add_com ("list", class_files, list_command, _("\
+ cmd_list_element *list_cmd
+ = add_com ("list", class_files, list_command, _("\
List specified function or line.\n\
With no argument, lists ten more lines after or around previous listing.\n\
\"list -\" lists the ten lines before a previous ten-line listing.\n\
This can be changed using \"set listsize\", and the current value\n\
can be shown using \"show listsize\"."));
- add_com_alias ("l", "list", class_files, 1);
+ add_com_alias ("l", list_cmd, class_files, 1);
if (dbx_commands)
- add_com_alias ("file", "list", class_files, 1);
+ add_com_alias ("file", list_cmd, class_files, 1);
c = add_com ("disassemble", class_vars, disassemble_command, _("\
Disassemble a specified section of memory.\n\
different of class_alias, as class_alias is used to identify
user defined aliases. */
-struct cmd_list_element *
-add_com_alias (const char *name, const char *target_name,
+cmd_list_element *
+add_com_alias (const char *name, cmd_list_element *target,
command_class theclass, int abbrev_flag)
{
- return add_alias_cmd (name, target_name, theclass, abbrev_flag, &cmdlist);
+ return add_alias_cmd (name, target, theclass, abbrev_flag, &cmdlist);
}
/* Add an element with a suppress notification to the list of commands. */
cmd_const_cfunc_ftype *fun,
const char *);
-extern struct cmd_list_element *add_com_alias (const char *, const char *,
- enum command_class, int);
+extern cmd_list_element *add_com_alias (const char *name,
+ cmd_list_element *target,
+ command_class theclass,
+ int abbrev_flag);
extern struct cmd_list_element *add_com_suppress_notification
(const char *name, enum command_class theclass,
compile_command, _("\
Command to compile source code and inject it into the inferior."),
&compile_command_list, 1, &cmdlist);
- add_com_alias ("expression", "compile", class_obscure, 0);
+ add_com_alias ("expression", compile_cmd_element, class_obscure, 0);
const auto compile_opts = make_compile_options_def_group (nullptr);
void
_initialize_gcore ()
{
- add_com ("generate-core-file", class_files, gcore_command, _("\
+ cmd_list_element *generate_core_file_cmd
+ = add_com ("generate-core-file", class_files, gcore_command, _("\
Save a core file with the current state of the debugged process.\n\
Usage: generate-core-file [FILENAME]\n\
Argument is optional filename. Default filename is 'core.PROCESS_ID'."));
- add_com_alias ("gcore", "generate-core-file", class_files, 1);
+ add_com_alias ("gcore", generate_core_file_cmd, class_files, 1);
}
static void
install_gdb_commands (void)
{
- add_com ("guile-repl", class_obscure,
- guile_repl_command,
+ cmd_list_element *guile_repl_cmd
+ = add_com ("guile-repl", class_obscure, guile_repl_command,
#ifdef HAVE_GUILE
_("\
Start an interactive Guile prompt.\n\
This command is only a placeholder.")
#endif /* HAVE_GUILE */
);
- add_com_alias ("gr", "guile-repl", class_obscure, 1);
+ add_com_alias ("gr", guile_repl_cmd, class_obscure, 1);
/* Since "help guile" is easy to type, and intuitive, we add general help
in using GDB+Guile to this command. */
This command is only a placeholder.")
#endif /* HAVE_GUILE */
);
- add_com_alias ("gu", "guile", class_obscure, 1);
+ add_com_alias ("gu", guile_cmd_element, class_obscure, 1);
add_basic_prefix_cmd ("guile", class_obscure,
_("Prefix command for Guile preference settings."),
the current thread only."));
set_cmd_completer (c, signal_completer);
- add_com ("stepi", class_run, stepi_command, _("\
+ cmd_list_element *stepi_cmd
+ = add_com ("stepi", class_run, stepi_command, _("\
Step one instruction exactly.\n\
Usage: stepi [N]\n\
Argument N means step N times (or till program stops for another \
reason)."));
- add_com_alias ("si", "stepi", class_run, 0);
+ add_com_alias ("si", stepi_cmd, class_run, 0);
- add_com ("nexti", class_run, nexti_command, _("\
+ cmd_list_element *nexti_cmd
+ = add_com ("nexti", class_run, nexti_command, _("\
Step one instruction, but proceed through subroutine calls.\n\
Usage: nexti [N]\n\
Argument N means step N times (or till program stops for another \
reason)."));
- add_com_alias ("ni", "nexti", class_run, 0);
+ add_com_alias ("ni", nexti_cmd, class_run, 0);
- add_com ("finish", class_run, finish_command, _("\
+ cmd_list_element *finish_cmd
+ = add_com ("finish", class_run, finish_command, _("\
Execute until selected stack frame returns.\n\
Usage: finish\n\
Upon return, the value returned is printed and put in the value history."));
- add_com_alias ("fin", "finish", class_run, 1);
+ add_com_alias ("fin", finish_cmd, class_run, 1);
- add_com ("next", class_run, next_command, _("\
+ cmd_list_element *next_cmd
+ = add_com ("next", class_run, next_command, _("\
Step program, proceeding through subroutine calls.\n\
Usage: next [N]\n\
Unlike \"step\", if the current source line calls a subroutine,\n\
this command does not enter the subroutine, but instead steps over\n\
the call, in effect treating it as a single source line."));
- add_com_alias ("n", "next", class_run, 1);
+ add_com_alias ("n", next_cmd, class_run, 1);
- add_com ("step", class_run, step_command, _("\
+ cmd_list_element *step_cmd
+ = add_com ("step", class_run, step_command, _("\
Step program until it reaches a different source line.\n\
Usage: step [N]\n\
Argument N means step N times (or till program stops for another \
reason)."));
- add_com_alias ("s", "step", class_run, 1);
+ add_com_alias ("s", step_cmd, class_run, 1);
- c = add_com ("until", class_run, until_command, _("\
+ cmd_list_element *until_cmd
+ = add_com ("until", class_run, until_command, _("\
Execute until past the current line or past a LOCATION.\n\
Execute until the program reaches a source line greater than the current\n\
or a specified location (same args as break command) within the current \
frame."));
- set_cmd_completer (c, location_completer);
- add_com_alias ("u", "until", class_run, 1);
+ set_cmd_completer (until_cmd, location_completer);
+ add_com_alias ("u", until_cmd, class_run, 1);
c = add_com ("advance", class_run, advance_command, _("\
Continue the program up to the given location (same form as args for break \
Execution will also stop upon exit from the current stack frame."));
set_cmd_completer (c, location_completer);
- c = add_com ("jump", class_run, jump_command, _("\
+ cmd_list_element *jump_cmd
+ = add_com ("jump", class_run, jump_command, _("\
Continue program being debugged at specified line or address.\n\
Usage: jump LOCATION\n\
Give as argument either LINENUM or *ADDR, where ADDR is an expression\n\
for an address to start at."));
- set_cmd_completer (c, location_completer);
- add_com_alias ("j", "jump", class_run, 1);
+ set_cmd_completer (jump_cmd, location_completer);
+ add_com_alias ("j", jump_cmd, class_run, 1);
- add_com ("continue", class_run, continue_command, _("\
+ cmd_list_element *continue_cmd
+ = add_com ("continue", class_run, continue_command, _("\
Continue program being debugged, after signal or breakpoint.\n\
Usage: continue [N]\n\
If proceeding from breakpoint, a number N may be used as an argument,\n\
otherwise all the threads in the program are continued. To \n\
continue all stopped threads in non-stop mode, use the -a option.\n\
Specifying -a and an ignore count simultaneously is an error."));
- add_com_alias ("c", "cont", class_run, 1);
- add_com_alias ("fg", "cont", class_run, 1);
+ add_com_alias ("c", continue_cmd, class_run, 1);
+ add_com_alias ("fg", continue_cmd, class_run, 1);
- c = add_com ("run", class_run, run_command, _("\
+ cmd_list_element *run_cmd
+ = add_com ("run", class_run, run_command, _("\
Start debugged program.\n"
RUN_ARGS_HELP));
- set_cmd_completer (c, filename_completer);
- add_com_alias ("r", "run", class_run, 1);
+ set_cmd_completer (run_cmd, filename_completer);
+ add_com_alias ("r", run_cmd, class_run, 1);
c = add_com ("start", class_run, start_command, _("\
Start the debugged program stopping at the beginning of the main procedure.\n"
{
struct cmd_list_element *cmd;
- add_basic_prefix_cmd ("maintenance", class_maintenance, _("\
+ cmd_list_element *maintenance_cmd
+ = add_basic_prefix_cmd ("maintenance", class_maintenance, _("\
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, 0,
- &cmdlist);
+ &maintenancelist, 0,
+ &cmdlist);
- add_com_alias ("mt", "maintenance", class_maintenance, 1);
+ add_com_alias ("mt", maintenance_cmd, class_maintenance, 1);
add_basic_prefix_cmd ("info", class_maintenance, _("\
Commands for showing internal info about the program being debugged."),
_("All Objective-C selectors, or those matching REGEXP."));
add_info ("classes", info_classes_command,
_("All Objective-C classes, or those matching REGEXP."));
- add_com ("print-object", class_vars, print_object_command,
- _("Ask an Objective-C object to print itself."));
- add_com_alias ("po", "print-object", class_vars, 1);
+ cmd_list_element *print_object_cmd
+ = add_com ("print-object", class_vars, print_object_command,
+ _("Ask an Objective-C object to print itself."));
+ add_com_alias ("po", print_object_cmd, class_vars, 1);
}
static void
but no count or size letter (see \"x\" command)."),
print_opts);
- c = add_com ("print", class_vars, print_command, print_help.c_str ());
- set_cmd_completer_handle_brkchars (c, print_command_completer);
- add_com_alias ("p", "print", class_vars, 1);
- add_com_alias ("inspect", "print", class_vars, 1);
+ cmd_list_element *print_cmd
+ = add_com ("print", class_vars, print_command, print_help.c_str ());
+ set_cmd_completer_handle_brkchars (print_cmd, print_command_completer);
+ add_com_alias ("p", print_cmd, class_vars, 1);
+ add_com_alias ("inspect", print_cmd, class_vars, 1);
add_setshow_uinteger_cmd ("max-symbolic-offset", no_class,
&max_symbolic_offset, _("\
void
_initialize_python ()
{
- add_com ("python-interactive", class_obscure,
- python_interactive_command,
+ cmd_list_element *python_interactive_cmd
+ = add_com ("python-interactive", class_obscure,
+ python_interactive_command,
#ifdef HAVE_PYTHON
_("\
Start an interactive Python prompt.\n\
This command is only a placeholder.")
#endif /* HAVE_PYTHON */
);
- add_com_alias ("pi", "python-interactive", class_obscure, 1);
+ add_com_alias ("pi", python_interactive_cmd, class_obscure, 1);
python_cmd_element = add_com ("python", class_obscure, python_command,
#ifdef HAVE_PYTHON
This command is only a placeholder.")
#endif /* HAVE_PYTHON */
);
- add_com_alias ("py", "python", class_obscure, 1);
+ add_com_alias ("py", python_cmd_element, class_obscure, 1);
/* Add set/show python print-stack. */
add_basic_prefix_cmd ("python", no_class,
set_record_call_history_size, NULL,
&set_record_cmdlist, &show_record_cmdlist);
- c = add_prefix_cmd ("record", class_obscure, cmd_record_start,
+ cmd_list_element *record_cmd
+ = add_prefix_cmd ("record", class_obscure, cmd_record_start,
_("Start recording."),
&record_cmdlist, 0, &cmdlist);
- set_cmd_completer (c, filename_completer);
+ set_cmd_completer (record_cmd, filename_completer);
- add_com_alias ("rec", "record", class_obscure, 1);
+ add_com_alias ("rec", record_cmd, class_obscure, 1);
add_basic_prefix_cmd ("record", class_support,
_("Set record options."), &set_record_cmdlist,
0, &setlist);
gdb::observers::thread_ptid_changed.attach (regcache_thread_ptid_changed,
"regcache");
- add_cmd ("register-cache", class_maintenance, reg_flush_command,
- _("Force gdb to flush its register and frame cache."),
- &maintenanceflushlist);
- c = add_com_alias ("flushregs", "maintenance flush register-cache",
+ cmd_list_element *maintenance_flush_register_cache_cmd
+ = add_cmd ("register-cache", class_maintenance, reg_flush_command,
+ _("Force gdb to flush its register and frame cache."),
+ &maintenanceflushlist);
+ c = add_com_alias ("flushregs", maintenance_flush_register_cache_cmd,
class_maintenance, 0);
deprecate_cmd (c, "maintenance flush register-cache");
void
_initialize_reverse ()
{
- add_com ("reverse-step", class_run, reverse_step, _("\
+ cmd_list_element *reverse_step_cmd
+ = add_com ("reverse-step", class_run, reverse_step, _("\
Step program backward until it reaches the beginning of another source line.\n\
-Argument N means do this N times (or till program stops for another reason).")
- );
- add_com_alias ("rs", "reverse-step", class_run, 1);
+Argument N means do this N times (or till program stops for another reason)."));
+ add_com_alias ("rs", reverse_step_cmd, class_run, 1);
- add_com ("reverse-next", class_run, reverse_next, _("\
+ cmd_list_element *reverse_next_cmd
+ = add_com ("reverse-next", class_run, reverse_next, _("\
Step program backward, proceeding through subroutine calls.\n\
Like the \"reverse-step\" command as long as subroutine calls do not happen;\n\
when they do, the call is treated as one instruction.\n\
-Argument N means do this N times (or till program stops for another reason).")
- );
- add_com_alias ("rn", "reverse-next", class_run, 1);
+Argument N means do this N times (or till program stops for another reason)."));
+ add_com_alias ("rn", reverse_next_cmd, class_run, 1);
- add_com ("reverse-stepi", class_run, reverse_stepi, _("\
+ cmd_list_element *reverse_stepi_cmd
+ = add_com ("reverse-stepi", class_run, reverse_stepi, _("\
Step backward exactly one instruction.\n\
-Argument N means do this N times (or till program stops for another reason).")
- );
- add_com_alias ("rsi", "reverse-stepi", class_run, 0);
+Argument N means do this N times (or till program stops for another reason)."));
+ add_com_alias ("rsi", reverse_stepi_cmd, class_run, 0);
- add_com ("reverse-nexti", class_run, reverse_nexti, _("\
+ cmd_list_element *reverse_nexti_cmd
+ = add_com ("reverse-nexti", class_run, reverse_nexti, _("\
Step backward one instruction, but proceed through called subroutines.\n\
-Argument N means do this N times (or till program stops for another reason).")
- );
- add_com_alias ("rni", "reverse-nexti", class_run, 0);
+Argument N means do this N times (or till program stops for another reason)."));
+ add_com_alias ("rni", reverse_nexti_cmd, class_run, 0);
- add_com ("reverse-continue", class_run, reverse_continue, _("\
+ cmd_list_element *reverse_continue_cmd
+ = add_com ("reverse-continue", class_run, reverse_continue, _("\
Continue program being debugged but run it in reverse.\n\
If proceeding from breakpoint, a number N may be used as an argument,\n\
which means to set the ignore count of that breakpoint to N - 1 (so that\n\
the breakpoint won't break until the Nth time it is reached)."));
- add_com_alias ("rc", "reverse-continue", class_run, 0);
+ add_com_alias ("rc", reverse_continue_cmd, class_run, 0);
add_com ("reverse-finish", class_run, reverse_finish, _("\
Execute backward until just before selected stack frame is called."));
void
_initialize_source ()
{
- struct cmd_list_element *c;
-
init_source_path ();
/* The intention is to use POSIX Basic Regular Expressions.
just an approximation. */
re_set_syntax (RE_SYNTAX_GREP);
- c = add_cmd ("directory", class_files, directory_command, _("\
+ cmd_list_element *directory_cmd
+ = add_cmd ("directory", class_files, directory_command, _("\
Add directory DIR to beginning of search path for source files.\n\
Forget cached info on source file locations and line positions.\n\
DIR can also be $cwd for the current working directory, or $cdir for the\n\
&cmdlist);
if (dbx_commands)
- add_com_alias ("use", "directory", class_files, 0);
+ add_com_alias ("use", directory_cmd, class_files, 0);
- set_cmd_completer (c, filename_completer);
+ set_cmd_completer (directory_cmd, filename_completer);
add_setshow_optional_filename_cmd ("directories",
class_files,
so that \"x/i\" suffices to start examining the machine code.\n\
The address is also stored as the value of \"$_\"."));
- add_com ("forward-search", class_files, forward_search_command, _("\
+ cmd_list_element *forward_search_cmd
+ = add_com ("forward-search", class_files, forward_search_command, _("\
Search for regular expression (see regex(3)) from last line listed.\n\
The matching line number is also stored as the value of \"$_\"."));
- add_com_alias ("search", "forward-search", class_files, 0);
- add_com_alias ("fo", "forward-search", class_files, 1);
+ add_com_alias ("search", forward_search_cmd, class_files, 0);
+ add_com_alias ("fo", forward_search_cmd, class_files, 1);
- add_com ("reverse-search", class_files, reverse_search_command, _("\
+ cmd_list_element *reverse_search_cmd
+ = add_com ("reverse-search", class_files, reverse_search_command, _("\
Search backward for regular expression (see regex(3)) from last line listed.\n\
The matching line number is also stored as the value of \"$_\"."));
- add_com_alias ("rev", "reverse-search", class_files, 1);
+ add_com_alias ("rev", reverse_search_cmd, class_files, 1);
add_setshow_integer_cmd ("listsize", class_support, &lines_to_list, _("\
Set number of source lines gdb will list by default."), _("\
Same as the `up' command, but does not print anything.\n\
This is useful in command scripts."));
- add_com ("down", class_stack, down_command, _("\
+ cmd_list_element *down_cmd
+ = add_com ("down", class_stack, down_command, _("\
Select and print stack frame called by this one.\n\
An argument says how many frames down to go."));
- add_com_alias ("do", "down", class_stack, 1);
- add_com_alias ("dow", "down", class_stack, 1);
+ add_com_alias ("do", down_cmd, class_stack, 1);
+ add_com_alias ("dow", down_cmd, class_stack, 1);
add_com ("down-silently", class_support, down_silently_command, _("\
Same as the `down' command, but does not print anything.\n\
This is useful in command scripts."));
- add_prefix_cmd ("frame", class_stack,
- &frame_cmd.base_command, _("\
+ cmd_list_element *frame_cmd_el
+ = add_prefix_cmd ("frame", class_stack,
+ &frame_cmd.base_command, _("\
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, 1, &cmdlist);
- add_com_alias ("f", "frame", class_stack, 1);
+ &frame_cmd_list, 1, &cmdlist);
+ add_com_alias ("f", frame_cmd_el, class_stack, 1);
#define FRAME_APPLY_OPTION_HELP "\
Prints the frame location information followed by COMMAND output.\n\
With a negative COUNT, print outermost -COUNT frames."),
backtrace_opts);
- cmd_list_element *c = add_com ("backtrace", class_stack,
- backtrace_command,
- backtrace_help.c_str ());
- set_cmd_completer_handle_brkchars (c, backtrace_command_completer);
+ cmd_list_element *backtrace_cmd
+ = add_com ("backtrace", class_stack, backtrace_command,
+ backtrace_help.c_str ());
+ set_cmd_completer_handle_brkchars (backtrace_cmd, backtrace_command_completer);
- add_com_alias ("bt", "backtrace", class_stack, 0);
+ add_com_alias ("bt", backtrace_cmd, class_stack, 0);
- add_com_alias ("where", "backtrace", class_stack, 0);
+ add_com_alias ("where", backtrace_cmd, class_stack, 0);
add_info ("stack", backtrace_command,
_("Backtrace of the stack, or innermost COUNT frames."));
add_info_alias ("s", "stack", 1);
on its own."), &cmdlist);
set_cmd_completer (c, filename_completer);
- add_basic_prefix_cmd ("overlay", class_support,
- _("Commands for debugging overlays."), &overlaylist,
- 0, &cmdlist);
+ cmd_list_element *overlay_cmd
+ = add_basic_prefix_cmd ("overlay", class_support,
+ _("Commands for debugging overlays."), &overlaylist,
+ 0, &cmdlist);
- add_com_alias ("ovly", "overlay", class_support, 1);
- add_com_alias ("ov", "overlay", class_support, 1);
+ add_com_alias ("ovly", overlay_cmd, class_support, 1);
+ add_com_alias ("ov", overlay_cmd, class_support, 1);
add_cmd ("map-overlay", class_support, map_overlay_command,
_("Assert that an overlay section is mapped."), &overlaylist);
c = add_info ("threads", info_threads_command, info_threads_help.c_str ());
set_cmd_completer_handle_brkchars (c, info_threads_command_completer);
- add_prefix_cmd ("thread", class_run, thread_command, _("\
+ cmd_list_element *thread_cmd
+ = 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, 1, &cmdlist);
+ &thread_cmd_list, 1, &cmdlist);
+
+ add_com_alias ("t", thread_cmd, class_run, 1);
#define THREAD_APPLY_OPTION_HELP "\
Prints per-inferior thread number and target system's thread id\n\
Will display thread ids whose name, target ID, or extra info matches REGEXP."),
&thread_cmd_list);
- add_com_alias ("t", "thread", class_run, 1);
-
add_setshow_boolean_cmd ("thread-events", no_class,
&print_thread_events, _("\
Set printing of thread events (such as thread start and exit)."), _("\
while single-stepping.\n\n\
Note: this command can only be used in a tracepoint \"actions\" list."));
- add_com_alias ("ws", "while-stepping", class_trace, 0);
- add_com_alias ("stepping", "while-stepping", class_trace, 0);
+ add_com_alias ("ws", while_stepping_cmd_element, class_trace, 0);
+ add_com_alias ("stepping", while_stepping_cmd_element, class_trace, 0);
add_com ("collect", class_trace, collect_pseudocommand, _("\
Specify one or more data items to be collected at a tracepoint.\n\
{
static struct cmd_list_element *tui_setlist;
static struct cmd_list_element *tui_showlist;
- struct cmd_list_element *cmd;
/* Define the classes of commands.
They will appear in the help list in the reverse of this order. */
add_com ("refresh", class_tui, tui_refresh_all_command,
_("Refresh the terminal display."));
- cmd = add_com ("tabset", class_tui, tui_set_tab_width_command, _("\
+ cmd_list_element *tabset_cmd
+ = add_com ("tabset", class_tui, tui_set_tab_width_command, _("\
Set the width (in characters) of tab stops.\n\
Usage: tabset N"));
- deprecate_cmd (cmd, "set tui tab-width");
+ deprecate_cmd (tabset_cmd, "set tui tab-width");
- cmd = add_com ("winheight", class_tui, tui_set_win_height_command, _("\
+ cmd_list_element *winheight_cmd
+ = add_com ("winheight", class_tui, tui_set_win_height_command, _("\
Set or modify the height of a specified window.\n\
Usage: winheight WINDOW-NAME [+ | -] NUM-LINES\n\
Use \"info win\" to see the names of the windows currently being displayed."));
- add_com_alias ("wh", "winheight", class_tui, 0);
- set_cmd_completer (cmd, winheight_completer);
+ add_com_alias ("wh", winheight_cmd, class_tui, 0);
+ set_cmd_completer (winheight_cmd, winheight_completer);
add_info ("win", tui_all_windows_info,
_("List of all displayed windows.\n\
Usage: info win"));
- cmd = add_com ("focus", class_tui, tui_set_focus_command, _("\
+ cmd_list_element *focus_cmd
+ = add_com ("focus", class_tui, tui_set_focus_command, _("\
Set focus to named window or next/prev window.\n\
Usage: focus [WINDOW-NAME | next | prev]\n\
Use \"info win\" to see the names of the windows currently being displayed."));
- add_com_alias ("fs", "focus", class_tui, 0);
- set_cmd_completer (cmd, focus_completer);
+ add_com_alias ("fs", focus_cmd, class_tui, 0);
+ set_cmd_completer (focus_cmd, focus_completer);
add_com ("+", class_tui, tui_scroll_forward_command, _("\
Scroll window forward.\n\
Usage: + [N] [WIN]\n\