import gdb-1999-07-05 snapshot
[deliverable/binutils-gdb.git] / gdb / top.c
index fa0c9d0f01cf439388f19ada0ef1c3ad7fdaad82..12b63754b8b3d90e1e0b23b7f60e77635fceb998 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -322,6 +322,12 @@ int remote_timeout = 20;   /* Set default to 20 */
 
 int remote_debug = 0;
 
+/* Non-zero means the target is running. Note: this is different from
+   saying that there is an active target and we are stopped at a
+   breakpoint, for instance. This is a real indicator whether the
+   target is off and running, which gdb is doing something else. */
+int target_executing = 0;
+
 /* Level of control structure.  */
 static int control_level;
 
@@ -383,11 +389,6 @@ void (*command_loop_hook) PARAMS ((void));
 
 void (*fputs_unfiltered_hook) PARAMS ((const char *linebuffer, GDB_FILE *stream));
 
-/* Called when the target says something to the host, which may
-   want to appear in a different window. */
-
-void (*target_output_hook) PARAMS ((char *));
-
 /* Called from print_frame_info to list the line we stopped in.  */
 
 void (*print_frame_info_listing_hook) PARAMS ((struct symtab *s, int line,
@@ -486,6 +487,8 @@ return_to_top_level (reason)
 
   disable_current_display ();
   do_cleanups (ALL_CLEANUPS);
+  if (async_p && target_has_async)
+    do_exec_cleanups (ALL_CLEANUPS);
 
   if (annotation_level > 1)
     switch (reason)
@@ -1266,6 +1269,16 @@ execute_command (p, from_tty)
       char *arg;
 
       c = lookup_cmd (&p, cmdlist, "", 0, 1);
+
+      /* If the target is running, we allow only a limited set of
+         commands. */
+      if (async_p && target_has_async && target_executing)
+       if (!strcmp (c->name, "help")
+           && !strcmp (c->name, "pwd")
+           && !strcmp (c->name, "show")
+           && !strcmp (c->name, "stop"))
+         error ("Cannot execute this command while the target is running.");
+
       /* Pass null arg rather than an empty one.  */
       arg = *p ? p : 0;
 
This page took 0.0239 seconds and 4 git commands to generate.