+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.
+
2017-05-17 Pedro Alves <palves@redhat.com>
* Makefile.in (nat_extra_makefile_frag): Rename to ...
}
struct cmd_list_element *
-add_alias_cmd (const char *name, const char *oldname, enum command_class theclass,
- int abbrev_flag, struct cmd_list_element **list)
+add_alias_cmd (const char *name, cmd_list_element *old,
+ enum command_class theclass, int abbrev_flag,
+ struct cmd_list_element **list)
{
- const char *tmp;
- struct cmd_list_element *old;
- struct cmd_list_element *c;
-
- tmp = oldname;
- old = lookup_cmd (&tmp, *list, "", 1, 1);
-
if (old == 0)
{
struct cmd_list_element *prehook, *prehookee, *posthook, *posthookee;
return 0;
}
- c = add_cmd (name, theclass, NULL, old->doc, list);
+ struct cmd_list_element *c = add_cmd (name, theclass, NULL, old->doc, list);
/* If OLD->DOC can be freed, we should make another copy. */
if (old->doc_allocated)
return c;
}
+struct cmd_list_element *
+add_alias_cmd (const char *name, const char *oldname,
+ enum command_class theclass, int abbrev_flag,
+ struct cmd_list_element **list)
+{
+ const char *tmp;
+ struct cmd_list_element *old;
+
+ tmp = oldname;
+ old = lookup_cmd (&tmp, *list, "", 1, 1);
+
+ return add_alias_cmd (name, old, theclass, abbrev_flag, list);
+}
+
+
/* Like add_cmd but adds an element for a command prefix: a name that
should be followed by a subcommand to be looked up in another
command list. PREFIXLIST should be the address of the variable
enum command_class, int,
struct cmd_list_element **);
+extern struct cmd_list_element *add_alias_cmd (const char *,
+ cmd_list_element *,
+ enum command_class, int,
+ struct cmd_list_element **);
+
+
extern struct cmd_list_element *add_prefix_cmd (const char *, enum command_class,
cmd_cfunc_ftype *fun,
const char *,
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,
+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.
+
2017-05-04 Pedro Alves <palves@redhat.com>
* gdb.python/py-record-btrace-threads.exp (check_insn_for_thread):
return -1
}
-proc test_set_inferior_tty { } {
+proc test_set_inferior_tty { command } {
global binfile
clean_restart ${binfile}
- gdb_test_no_output "set inferior-tty hello" "set inferior-tty to hello"
+ gdb_test_no_output "$command hello" "set inferior-tty to hello"
gdb_test "show inferior-tty" \
"Terminal for future runs of program being debugged is \"hello\"." \
"show inferior-tty shows hello"
- gdb_test_no_output "set inferior-tty" "set inferior-tty to empty"
+ gdb_test_no_output "$command" "set inferior-tty to empty"
gdb_test "show inferior-tty" \
"Terminal for future runs of program being debugged is \"\"." \
"show inferior-tty shows empty"
}
-test_set_inferior_tty
+foreach_with_prefix command {"set inferior-tty" "tty"} {
+ test_set_inferior_tty $command
+}