+2013-10-02  Pedro Alves  <palves@redhat.com>
+
+       * server.c (process_serial_event): Don't output "GDBserver
+       exiting" if GDB is connected through stdio.
+       * target.c (mywait): Likewise, be silent if GDB is connected
+       through stdio.
+
 2013-10-01  Joel Brobecker  <brobecker@adacore.com>
 
        * lynx-low.c (lynx_add_threads_after_attach): New function.
 
         the whole vStopped list (until it gets an OK).  */
       if (QUEUE_is_empty (notif_event_p, notif_stop.queue))
        {
-         fprintf (stderr, "GDBserver exiting\n");
+         /* Be transparent when GDB is connected through stdio -- no
+            need to spam GDB's console.  */
+         if (!remote_connection_is_stdio ())
+           fprintf (stderr, "GDBserver exiting\n");
          remote_close ();
          exit (0);
        }
 
 
   ret = (*the_target->wait) (ptid, ourstatus, options);
 
-  if (ourstatus->kind == TARGET_WAITKIND_EXITED)
-    fprintf (stderr,
-            "\nChild exited with status %d\n", ourstatus->value.integer);
-  else if (ourstatus->kind == TARGET_WAITKIND_SIGNALLED)
-    fprintf (stderr, "\nChild terminated with signal = 0x%x (%s)\n",
-            gdb_signal_to_host (ourstatus->value.sig),
-            gdb_signal_to_name (ourstatus->value.sig));
+  /* If GDB is connected through TCP/serial, then GDBserver will most
+     probably be running on its own terminal/console, so it's nice to
+     print there why is GDBserver exiting.  If however, GDB is
+     connected through stdio, then there's no need to spam the GDB
+     console with this -- the user will already see the exit through
+     regular GDB output, in that same terminal.  */
+  if (!remote_connection_is_stdio ())
+    {
+      if (ourstatus->kind == TARGET_WAITKIND_EXITED)
+       fprintf (stderr,
+                "\nChild exited with status %d\n", ourstatus->value.integer);
+      else if (ourstatus->kind == TARGET_WAITKIND_SIGNALLED)
+       fprintf (stderr, "\nChild terminated with signal = 0x%x (%s)\n",
+                gdb_signal_to_host (ourstatus->value.sig),
+                gdb_signal_to_name (ourstatus->value.sig));
+    }
 
   if (connected_wait)
     server_waiting = 0;