aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2013-03-29 15:21:23 +0000
committerYao Qi <yao@codesourcery.com>2013-03-29 15:21:23 +0000
commit9852c492bd1c33290056351227ed7f314ff045c3 (patch)
tree2e1563c05221d718490bd201bb21eac3b4635288 /gdb/target.c
parentaf312be73153278ccc14e39c40a2bb0923578aa8 (diff)
downloadgdb-9852c492bd1c33290056351227ed7f314ff045c3.zip
gdb-9852c492bd1c33290056351227ed7f314ff045c3.tar.gz
gdb-9852c492bd1c33290056351227ed7f314ff045c3.tar.bz2
gdb/
2013-03-29 Yao Qi <yao@codesourcery.com> * corelow.c: Include "completer.h". (_initialize_corelow): Call add_target_with_completer with argument 'filename_completer'. * tracepoint.c: Likewise. * exec.c (_initialize_exec): Likewise. * target.c (add_target): Rename to ... (add_target_with_completer): ... this. Call set_cmd_completer if parameter completer is not NULL. (add_target): New. * target.h: Include "command.h". (add_target_with_completer): Declare it. gdb/testsuite: 2013-03-29 Yao Qi <yao@codesourcery.com> * gdb.base/completion.exp: Test completion of commands "target core", "target tfile" and "target exec". * gdb.trace/tfile.exp: Test completion of command "target tfile".
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/gdb/target.c b/gdb/target.c
index 9193c97..24cc79d 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -384,11 +384,16 @@ target_has_execution_current (void)
return target_has_execution_1 (inferior_ptid);
}
-/* Add a possible target architecture to the list. */
+/* Add possible target architecture T to the list and add a new
+ command 'target T->to_shortname'. Set COMPLETER as the command's
+ completer if not NULL. */
void
-add_target (struct target_ops *t)
+add_target_with_completer (struct target_ops *t,
+ completer_ftype *completer)
{
+ struct cmd_list_element *c;
+
/* Provide default values for all "must have" methods. */
if (t->to_xfer_partial == NULL)
t->to_xfer_partial = default_xfer_partial;
@@ -431,7 +436,18 @@ Remaining arguments are interpreted by the target protocol. For more\n\
information on the arguments for a particular protocol, type\n\
`help target ' followed by the protocol name."),
&targetlist, "target ", 0, &cmdlist);
- add_cmd (t->to_shortname, no_class, t->to_open, t->to_doc, &targetlist);
+ c = add_cmd (t->to_shortname, no_class, t->to_open, t->to_doc,
+ &targetlist);
+ if (completer != NULL)
+ set_cmd_completer (c, completer);
+}
+
+/* Add a possible target architecture to the list. */
+
+void
+add_target (struct target_ops *t)
+{
+ add_target_with_completer (t, NULL);
}
/* See target.h. */