gdb: make add_info_alias accept target as a cmd_list_element

Same idea as previous patch, but for add_info_alias.

gdb/ChangeLog:

	* command.h (add_info_alias): Accept target as
	cmd_list_element.  Update callers.

Change-Id: If830d423364bf42d7bea5ac4dd3a81adcfce6f7a
This commit is contained in:
Simon Marchi 2021-05-27 13:59:01 -04:00
parent 3947f654ea
commit e0f25bd971
9 changed files with 42 additions and 28 deletions

View file

@ -1,3 +1,8 @@
2021-05-27 Simon Marchi <simon.marchi@polymtl.ca>
* command.h (add_info_alias): Accept target as
cmd_list_element. Update callers.
2021-05-27 Simon Marchi <simon.marchi@polymtl.ca>
* command.h (add_com_alias): Accept target as

View file

@ -15870,7 +15870,8 @@ Convenience variable \"$bpnum\" contains the number of the last\n\
breakpoint set."));
}
add_info ("breakpoints", info_breakpoints_command, _("\
cmd_list_element *info_breakpoints_cmd
= add_info ("breakpoints", info_breakpoints_command, _("\
Status of specified breakpoints (all user-settable breakpoints if no argument).\n\
The \"Type\" column indicates one of:\n\
\tbreakpoint - normal breakpoint\n\
@ -15886,7 +15887,7 @@ is prefixed with \"server \".\n\n\
Convenience variable \"$bpnum\" contains the number of the last\n\
breakpoint set."));
add_info_alias ("b", "breakpoints", 1);
add_info_alias ("b", info_breakpoints_cmd, 1);
add_cmd ("breakpoints", class_maintenance, maintenance_info_breakpoints, _("\
Status of all breakpoints, or breakpoint number NUMBER.\n\
@ -16053,12 +16054,13 @@ Do \"help breakpoints\" for info on other commands dealing with breakpoints.\n\
Do \"help tracepoints\" for info on other tracepoint commands."));
set_cmd_completer (c, location_completer);
add_info ("tracepoints", info_tracepoints_command, _("\
cmd_list_element *info_tracepoints_cmd
= add_info ("tracepoints", info_tracepoints_command, _("\
Status of specified tracepoints (all tracepoints if no argument).\n\
Convenience variable \"$tpnum\" contains the number of the\n\
last tracepoint set."));
add_info_alias ("tp", "tracepoints", 1);
add_info_alias ("tp", info_tracepoints_cmd, 1);
add_cmd ("tracepoints", class_trace, delete_trace_command, _("\
Delete specified tracepoints.\n\

View file

@ -986,10 +986,10 @@ add_info (const char *name, cmd_const_cfunc_ftype *fun, const char *doc)
/* Add an alias to the list of info subcommands. */
struct cmd_list_element *
add_info_alias (const char *name, const char *target_name, int abbrev_flag)
cmd_list_element *
add_info_alias (const char *name, cmd_list_element *target, int abbrev_flag)
{
return add_alias_cmd (name, target_name, class_run, abbrev_flag, &infolist);
return add_alias_cmd (name, target, class_run, abbrev_flag, &infolist);
}
/* Add an element to the list of commands. */

View file

@ -373,8 +373,9 @@ extern struct cmd_list_element *add_info (const char *,
cmd_const_cfunc_ftype *fun,
const char *);
extern struct cmd_list_element *add_info_alias (const char *, const char *,
int);
extern cmd_list_element *add_info_alias (const char *name,
cmd_list_element *target,
int abbrev_flag);
extern void complete_on_cmdlist (struct cmd_list_element *,
completion_tracker &tracker,

View file

@ -790,10 +790,11 @@ This command is only a placeholder.")
&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, 0, &infolist);
add_info_alias ("gu", "guile", 1);
cmd_list_element *info_guile_cmd
= add_basic_prefix_cmd ("guile", class_obscure,
_("Prefix command for Guile info displays."),
&info_guile_list, 0, &infolist);
add_info_alias ("gu", info_guile_cmd, 1);
/* The name "print-stack" is carried over from Python.
A better name is "print-exception". */

View file

@ -3276,13 +3276,14 @@ If non-stop mode is enabled, interrupt only the current thread,\n\
otherwise all the threads in the program are stopped. To \n\
interrupt all running threads in non-stop mode, use the -a option."));
c = add_info ("registers", info_registers_command, _("\
cmd_list_element *info_registers_cmd
= add_info ("registers", info_registers_command, _("\
List of integer registers and their contents, for selected stack frame.\n\
One or more register names as argument means describe the given registers.\n\
One or more register group names as argument means describe the registers\n\
in the named register groups."));
add_info_alias ("r", "registers", 1);
set_cmd_completer (c, reg_or_group_completer);
add_info_alias ("r", info_registers_cmd, 1);
set_cmd_completer (info_registers_cmd, reg_or_group_completer);
c = add_info ("all-registers", info_all_registers_command, _("\
List of all registers and their contents, for selected stack frame.\n\

View file

@ -9501,10 +9501,11 @@ _initialize_infrun ()
= create_async_event_handler (infrun_async_inferior_event_handler, NULL,
"infrun");
add_info ("signals", info_signals_command, _("\
cmd_list_element *info_signals_cmd
= add_info ("signals", info_signals_command, _("\
What debugger does when program gets various signals.\n\
Specify a signal as argument to print info on that signal only."));
add_info_alias ("handle", "signals", 0);
add_info_alias ("handle", info_signals_cmd, 0);
c = add_com ("handle", class_run, handle_command, _("\
Specify how to handle signals.\n\

View file

@ -1565,9 +1565,10 @@ _initialize_solib ()
add_com ("sharedlibrary", class_files, sharedlibrary_command,
_("Load shared object library symbols for files matching REGEXP."));
add_info ("sharedlibrary", info_sharedlibrary_command,
_("Status of loaded shared object libraries."));
add_info_alias ("dll", "sharedlibrary", 1);
cmd_list_element *info_sharedlibrary_cmd
= add_info ("sharedlibrary", info_sharedlibrary_command,
_("Status of loaded shared object libraries."));
add_info_alias ("dll", info_sharedlibrary_cmd, 1);
add_com ("nosharedlibrary", class_files, no_shared_libraries,
_("Unload all shared object library symbols."));

View file

@ -3508,17 +3508,19 @@ With a negative COUNT, print outermost -COUNT frames."),
add_com_alias ("bt", backtrace_cmd, 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);
cmd_list_element *info_stack_cmd
= add_info ("stack", backtrace_command,
_("Backtrace of the stack, or innermost COUNT frames."));
add_info_alias ("s", info_stack_cmd, 1);
add_prefix_cmd ("frame", class_info, &info_frame_cmd.base_command,
_("All about the selected stack frame.\n\
cmd_list_element *info_frame_cmd_el
= add_prefix_cmd ("frame", class_info, &info_frame_cmd.base_command,
_("All about the selected stack frame.\n\
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, 1, &infolist);
add_info_alias ("f", "frame", 1);
&info_frame_cmd_list, 1, &infolist);
add_info_alias ("f", info_frame_cmd_el, 1);
add_cmd ("address", class_stack, &info_frame_cmd.address,
_("\