summaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-07-25 14:28:14 +0000
committerTom Tromey <tromey@redhat.com>2013-07-25 14:28:14 +0000
commit56f4fed4c8ec7ea80656cecac20f5077f08a5854 (patch)
tree86d372a98adc97e02768d1beafa9ca1b28ef6c62 /gdb/target.c
parente73fd3d4b8b7c697660398b913e3898044e1fe5f (diff)
downloadgdb-56f4fed4c8ec7ea80656cecac20f5077f08a5854.tar.gz
don't call add_target for thread_db_ops
Right now, "help target" will include this line: target multi-thread -- Threads and pthreads support However, it doesn't make sense to invoke "target multi-thread". This patch fixes the problem by not registering the multi-thread target. add_target does some needed initialization of the target_ops, so I broke this out into a new function. It isn't clear to me whether this patch requires a test case or not. I'm not sure whether there are other unregistered targets; but if there are, it seems unlikely that we test for their absence from the help. Built and regtested on x86-64 Fedora 18. * linux-thread-db.c (init_thread_db_ops): Call complete_target_initialization. (_initialize_thread_db): Don't call add_target. * target.c (complete_target_initialization): New function. (add_target_with_completer): Call it. * target.h (complete_target_initialization): Declare.
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/gdb/target.c b/gdb/target.c
index 18e10cbdced..37b0a94b0cf 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -381,16 +381,12 @@ target_has_execution_current (void)
return target_has_execution_1 (inferior_ptid);
}
-/* 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. */
+/* Complete initialization of T. This ensures that various fields in
+ T are set, if needed by the target implementation. */
void
-add_target_with_completer (struct target_ops *t,
- completer_ftype *completer)
+complete_target_initialization (struct target_ops *t)
{
- 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;
@@ -409,6 +405,19 @@ add_target_with_completer (struct target_ops *t,
if (t->to_has_execution == NULL)
t->to_has_execution = (int (*) (struct target_ops *, ptid_t)) return_zero;
+}
+
+/* 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_with_completer (struct target_ops *t,
+ completer_ftype *completer)
+{
+ struct cmd_list_element *c;
+
+ complete_target_initialization (t);
if (!target_structs)
{