diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-05-27 13:59:01 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-05-27 14:00:07 -0400 |
commit | 3947f654eabb1b6ccf8aad11ece46dc4b027f0f0 (patch) | |
tree | ce1f687f4929daf2ce5aa10741c244cb1ab6e7ab /gdb/maint.c | |
parent | 7bd22f56a3cf47c6743f7f7989a6fa07f935d31b (diff) | |
download | binutils-gdb-3947f654eabb1b6ccf8aad11ece46dc4b027f0f0.tar.gz |
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
Diffstat (limited to 'gdb/maint.c')
-rw-r--r-- | gdb/maint.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gdb/maint.c b/gdb/maint.c index 154bef55981..91a7f77d0eb 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -1133,14 +1133,15 @@ _initialize_maint_cmds () { 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."), |