gdb/
[deliverable/binutils-gdb.git] / gdb / event-top.c
index 61c431dabf271e6d67187fd842cb271daf474fda..31ebd4ea0042d87a3181267a4f4511c755de8c08 100644 (file)
@@ -1,6 +1,6 @@
 /* Top level stuff for GDB, the GNU debugger.
 
-   Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2008
+   Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2008, 2009
    Free Software Foundation, Inc.
 
    Written by Elena Zannoni <ezannoni@cygnus.com> of Cygnus Solutions.
@@ -458,14 +458,11 @@ async_enable_stdin (void)
 void
 async_disable_stdin (void)
 {
-  sync_execution = 1;
-  push_prompt ("", "", "");
-  /* FIXME: cagney/1999-09-27: At present this call is technically
-     redundant since infcmd.c and infrun.c both already call
-     target_terminal_inferior().  As the terminal handling (in
-     sync/async mode) is refined, the duplicate calls can be
-     eliminated (Here or in infcmd.c/infrun.c). */
-  target_terminal_inferior ();
+  if (!sync_execution)
+    {
+      sync_execution = 1;
+      push_prompt ("", "", "");
+    }
 }
 \f
 
@@ -478,7 +475,6 @@ async_disable_stdin (void)
 static void
 command_handler (char *command)
 {
-  struct cleanup *old_chain;
   int stdin_is_tty = ISATTY (stdin);
   long time_at_cmd_start;
 #ifdef HAVE_SBRK
@@ -490,7 +486,6 @@ command_handler (char *command)
   quit_flag = 0;
   if (instream == stdin && stdin_is_tty)
     reinitialize_more_filter ();
-  old_chain = make_cleanup (null_cleanup, 0);
 
   /* If readline returned a NULL command, it means that the 
      connection with the terminal is gone. This happens at the
@@ -515,35 +510,29 @@ command_handler (char *command)
 
   execute_command (command, instream == stdin);
 
-  /* Do any commands attached to breakpoint we stopped at. Only if we
-     are always running synchronously. Or if we have just executed a
-     command that doesn't start the target. */
-  if (!target_can_async_p () || is_stopped (inferior_ptid))
-    {
-      bpstat_do_actions (&stop_bpstat);
-      do_cleanups (old_chain);
+  /* Do any commands attached to breakpoint we stopped at.  */
+  bpstat_do_actions ();
 
-      if (display_time)
-       {
-         long cmd_time = get_run_time () - time_at_cmd_start;
+  if (display_time)
+    {
+      long cmd_time = get_run_time () - time_at_cmd_start;
 
-         printf_unfiltered (_("Command execution time: %ld.%06ld\n"),
-                            cmd_time / 1000000, cmd_time % 1000000);
-       }
+      printf_unfiltered (_("Command execution time: %ld.%06ld\n"),
+                        cmd_time / 1000000, cmd_time % 1000000);
+    }
 
-      if (display_space)
-       {
+  if (display_space)
+    {
 #ifdef HAVE_SBRK
-         char *lim = (char *) sbrk (0);
-         long space_now = lim - lim_at_start;
-         long space_diff = space_now - space_at_cmd_start;
-
-         printf_unfiltered (_("Space used: %ld (%c%ld for this command)\n"),
-                            space_now,
-                            (space_diff >= 0 ? '+' : '-'),
-                            space_diff);
+      char *lim = (char *) sbrk (0);
+      long space_now = lim - lim_at_start;
+      long space_diff = space_now - space_at_cmd_start;
+
+      printf_unfiltered (_("Space used: %ld (%c%ld for this command)\n"),
+                        space_now,
+                        (space_diff >= 0 ? '+' : '-'),
+                        space_diff);
 #endif
-       }
     }
 }
 
@@ -985,7 +974,7 @@ async_disconnect (gdb_client_data arg)
                "Could not kill the program being debugged",
                RETURN_MASK_ALL);
   signal (SIGHUP, SIG_DFL);    /*FIXME: ??????????? */
-  kill (getpid (), SIGHUP);
+  raise (SIGHUP);
 }
 #endif
 
@@ -1013,7 +1002,7 @@ async_stop_sig (gdb_client_data arg)
 #elif HAVE_SIGSETMASK
   sigsetmask (0);
 #endif
-  kill (getpid (), SIGTSTP);
+  raise (SIGTSTP);
   signal (SIGTSTP, handle_stop_sig);
 #else
   signal (STOP_SIGNAL, handle_stop_sig);
This page took 0.041265 seconds and 4 git commands to generate.