mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-05-25 03:06:11 +08:00
gdb: make add_com_alias accept target as a cmd_list_element
The alias creation functions currently accept a name to specify the target command. They pass this to add_alias_cmd, which needs to lookup the target command by name. Given that: - We don't support creating an alias for a command before that command exists. - We always use add_info_alias just after creating that target command, and therefore have access to the target command's cmd_list_element. ... change add_com_alias to accept the target command as a cmd_list_element (other functions are done in subsequent patches). This ensures we don't create the alias before the target command, because you need to get the cmd_list_element from somewhere when you call the alias creation function. And it avoids an unecessary command lookup. So it seems better to me in every aspect. gdb/ChangeLog: * command.h (add_com_alias): Accept target as cmd_list_element. Update callers. Change-Id: I24bed7da57221cc77606034de3023fedac015150
This commit is contained in:
@ -1886,8 +1886,9 @@ void _initialize_python ();
|
||||
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\
|
||||
@ -1909,7 +1910,7 @@ Python scripting is not supported in this copy of GDB.\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
|
||||
@ -1931,7 +1932,7 @@ Python scripting is not supported in this copy of GDB.\n\
|
||||
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,
|
||||
|
Reference in New Issue
Block a user