aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2008-02-28 16:26:18 +0000
committerDaniel Jacobowitz <drow@false.org>2008-02-28 16:26:18 +0000
commit8edfe2693228f91b78661dc04e8c91095ab19487 (patch)
treeeedbb500de71648048b63f651ab5b3b13aeb07d4 /gdb/target.c
parent0d6ba1b16e08532da8a7fa2de4d867927cf3f9f6 (diff)
downloadgdb-8edfe2693228f91b78661dc04e8c91095ab19487.zip
gdb-8edfe2693228f91b78661dc04e8c91095ab19487.tar.gz
gdb-8edfe2693228f91b78661dc04e8c91095ab19487.tar.bz2
* infcmd.c (kill_if_already_running): Make static. Use
target_require_runnable. * target.c (target_require_runnable): New. * target.h (target_require_runnable): Declare. * gdb.texinfo (Starting): Mention always-running targets. (Target Commands): Add an anchor for load. (Connecting): Explain continue instead of run.
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/gdb/target.c b/gdb/target.c
index 87ddf24..ceb71b3 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -1723,6 +1723,41 @@ target_read_description (struct target_ops *target)
return NULL;
}
+/* Look through the currently pushed targets. If none of them will
+ be able to restart the currently running process, issue an error
+ message. */
+
+void
+target_require_runnable (void)
+{
+ struct target_ops *t;
+
+ for (t = target_stack; t != NULL; t = t->beneath)
+ {
+ /* If this target knows how to create a new program, then
+ assume we will still be able to after killing the current
+ one. Either killing and mourning will not pop T, or else
+ find_default_run_target will find it again. */
+ if (t->to_create_inferior != NULL)
+ return;
+
+ /* Do not worry about thread_stratum targets that can not
+ create inferiors. Assume they will be pushed again if
+ necessary, and continue to the process_stratum. */
+ if (t->to_stratum == thread_stratum)
+ continue;
+
+ error (_("\
+The \"%s\" target does not support \"run\". Try \"help target\" or \"continue\"."),
+ t->to_shortname);
+ }
+
+ /* This function is only called if the target is running. In that
+ case there should have been a process_stratum target and it
+ should either know how to create inferiors, or not... */
+ internal_error (__FILE__, __LINE__, "No targets found");
+}
+
/* Look through the list of possible targets for a target that can
execute a run or attach command without any other data. This is
used to locate the default process stratum.