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:
parent
7bd22f56a3
commit
3947f654ea
22 changed files with 219 additions and 173 deletions
|
@ -1007,11 +1007,11 @@ add_com (const char *name, enum command_class theclass,
|
|||
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. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue