diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 469a2df1a4..3138f47868 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,10 @@ +2013-10-02 Pedro Alves + + * 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 * lynx-low.c (lynx_add_threads_after_attach): New function. diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 4de20d5bb8..e0af78547e 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -3550,7 +3550,10 @@ process_serial_event (void) 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); } diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c index 1a0dee280e..d4a2a98721 100644 --- a/gdb/gdbserver/target.c +++ b/gdb/gdbserver/target.c @@ -82,13 +82,22 @@ mywait (ptid_t ptid, struct target_waitstatus *ourstatus, int options, 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;