* sol-thread.c (_initialize_sol_thread): Add FIXME regarding
[deliverable/binutils-gdb.git] / gdb / top.c
index 3041a330be8c4335e6c3fac912bcd0e42b341b0a..593da2d22939e7aecd382fa6545aa57548604ca4 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -46,6 +46,7 @@
 #include "gdb_assert.h"
 #include "main.h"
 #include "event-loop.h"
+#include "gdbthread.h"
 
 /* readline include files */
 #include "readline/readline.h"
@@ -181,12 +182,6 @@ int remote_timeout = 2;
 
 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;
-
 /* Sbrk location on entry to main.  Used for statistics only.  */
 #ifdef HAVE_SBRK
 char *lim_at_start;
@@ -251,13 +246,6 @@ void (*deprecated_readline_begin_hook) (char *, ...);
 char *(*deprecated_readline_hook) (char *);
 void (*deprecated_readline_end_hook) (void);
 
-/* Called as appropriate to notify the interface of the specified breakpoint
-   conditions.  */
-
-void (*deprecated_create_breakpoint_hook) (struct breakpoint * bpt);
-void (*deprecated_delete_breakpoint_hook) (struct breakpoint * bpt);
-void (*deprecated_modify_breakpoint_hook) (struct breakpoint * bpt);
-
 /* Called as appropriate to notify the interface that we have attached
    to or detached from an already running process. */
 
@@ -367,6 +355,8 @@ do_chdir_cleanup (void *old_dir)
 /* Execute the line P as a command.
    Pass FROM_TTY as second argument to the defining function.  */
 
+/* Execute command P, in the current user context.  */
+
 void
 execute_command (char *p, int from_tty)
 {
@@ -374,8 +364,6 @@ execute_command (char *p, int from_tty)
   enum language flang;
   static int warned = 0;
   char *line;
-  struct continuation_arg *arg1;
-  struct continuation_arg *arg2;
   long time_at_cmd_start = 0;
 #ifdef HAVE_SBRK
   long space_at_cmd_start = 0;
@@ -420,10 +408,13 @@ execute_command (char *p, int from_tty)
 
       c = lookup_cmd (&p, cmdlist, "", 0, 1);
 
-      /* If the target is running, we allow only a limited set of
-         commands. */
-      if (target_can_async_p () && target_executing && !get_cmd_async_ok (c))
-       error (_("Cannot execute this command while the target is running."));
+      /* If the selected thread has terminated, we allow only a
+        limited set of commands.  */
+      if (target_can_async_p ()
+         && is_exited (inferior_ptid)
+         && !get_cmd_no_selected_thread_ok (c))
+       error (_("\
+Cannot execute this command without a live selected thread.  See `help thread'."));
 
       /* Pass null arg rather than an empty one.  */
       arg = *p ? p : 0;
@@ -486,7 +477,7 @@ execute_command (char *p, int from_tty)
   /* FIXME:  This should be cacheing the frame and only running when
      the frame changes.  */
 
-  if (!target_executing && target_has_stack)
+  if (target_has_stack && is_stopped (inferior_ptid))
     {
       flang = get_frame_language ();
       if (!warned
@@ -543,8 +534,10 @@ command_loop (void)
        }
 
       execute_command (command, instream == stdin);
-      /* Do any commands attached to breakpoint we stopped at.  */
-      bpstat_do_actions (&stop_bpstat);
+
+      /* Do any commands attached to breakpoint we are stopped at.  */
+      bpstat_do_actions ();
+
       do_cleanups (old_chain);
 
       if (display_time)
@@ -1159,7 +1152,7 @@ and \"show warranty\" for details.\n");
     {
       fprintf_filtered (stream, 
                        _("\nFor bug reporting instructions, please see:\n"));
-      fprintf_filtered (stream, "%s.\n", REPORT_BUGS_TO);
+      fprintf_filtered (stream, "%s.", REPORT_BUGS_TO);
     }
 }
 \f
@@ -1231,8 +1224,9 @@ quit_target (void *arg)
         target_kill ();
     }
 
-  /* UDI wants this, to kill the TIP.  */
-  target_close (&current_target, 1);
+  /* Give all pushed targets a chance to do minimal cleanup, and pop
+     them all out.  */
+  pop_all_targets (1);
 
   /* Save the history information if it is appropriate to do so.  */
   if (write_history_p && history_filename)
This page took 0.026676 seconds and 4 git commands to generate.