aboutsummaryrefslogtreecommitdiff
path: root/gdb/infcmd.c
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2017-05-17 14:22:04 +0100
committerYao Qi <yao.qi@linaro.org>2017-05-17 14:22:35 +0100
commit21873064e835ffb16e92048482e34f19e6a415da (patch)
tree55a7255c003a78c18b43e618c6b9c7a5f0120c8b /gdb/infcmd.c
parent2b351b19efc8dd36ac8a8bda005c7411536b93ec (diff)
downloadgdb-21873064e835ffb16e92048482e34f19e6a415da.zip
gdb-21873064e835ffb16e92048482e34f19e6a415da.tar.gz
gdb-21873064e835ffb16e92048482e34f19e6a415da.tar.bz2
Add alias command to cmd_list_element
When we add alias command, we call add_alias_cmd and pass the alias name and command name. This implicitly requires the command and its prefix commands are already added to cmdlist. This may not be true, for example, add_com_alias ("tty", "set inferior-tty", class_alias, 0); "inferior-tty" command is added to setlist, but setlist may not be added to cmdlist (It depends on the order of related _initialize_XXX functions called) so that we can't find "set inferior-tty" from cmdlist. This patch fixes this problem by passing cmd_list_element of "inferior-tty" to add_alias_cmd, so that cmd_list_element of "inferior-tty" doesn't have to be reachable from cmdlist at that moment. gdb: 2017-05-17 Yao Qi <yao.qi@linaro.org> * cli/cli-decode.c (add_alias_cmd): New function. * command.h (add_alias_cmd): Declare. * infcmd.c (_initialize_infcmd): Don't call add_com_alias, instead call add_alias_cmd. gdb/testsuite: 2017-05-17 Simon Marchi <simon.marchi@ericsson.com> * gdb.base/set-inferior-tty.exp (test_set_inferior_tty): Add argument command. (top-level): Invoke test_set_inferior_tty.
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r--gdb/infcmd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index f42c6d1..09060b5 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -3210,7 +3210,10 @@ is restored."),
set_inferior_tty_command,
show_inferior_tty_command,
&setlist, &showlist);
- add_com_alias ("tty", "set inferior-tty", class_alias, 0);
+ cmd_name = "inferior-tty";
+ c = lookup_cmd (&cmd_name, setlist, "", -1, 1);
+ gdb_assert (c != NULL);
+ add_alias_cmd ("tty", c, class_alias, 0, &cmdlist);
cmd_name = "args";
add_setshow_string_noescape_cmd (cmd_name, class_run,