diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/gdbserver/remote-utils.c | 5 | ||||
-rw-r--r-- | gdb/gdbserver/server.c | 40 |
2 files changed, 18 insertions, 27 deletions
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c index 77280f7..05e3d63 100644 --- a/gdb/gdbserver/remote-utils.c +++ b/gdb/gdbserver/remote-utils.c @@ -882,7 +882,10 @@ readchar (void) if (readchar_bufcnt <= 0) { if (readchar_bufcnt == 0) - fprintf (stderr, "readchar: Got EOF\n"); + { + if (remote_debug) + fprintf (stderr, "readchar: Got EOF\n"); + } else perror ("readchar"); diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 18e9bf1..5e053b3 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -3691,11 +3691,21 @@ captured_main (int argc, char *argv[]) start_event_loop (); /* If an exit was requested (using the "monitor exit" - command), terminate now. The only other way to get - here is for getpkt to fail; close the connection - and reopen it at the top of the loop. */ + command), terminate now. */ + if (exit_requested) + throw_quit ("Quit"); + + /* The only other way to get here is for getpkt to fail: + + - If --once was specified, we're done. - if (exit_requested || run_once) + - If not in extended-remote mode, and we're no longer + debugging anything, simply exit: GDB has disconnected + after processing the last process exit. + + - Otherwise, close the connection and reopen it at the + top of the loop. */ + if (run_once || (!extended_protocol && !target_running ())) throw_quit ("Quit"); fprintf (stderr, @@ -3860,13 +3870,6 @@ process_serial_event (void) int packet_len; int new_packet_len = -1; - /* Used to decide when gdbserver should exit in - multi-mode/remote. */ - static int have_ran = 0; - - if (!have_ran) - have_ran = target_running (); - disable_async_io (); response_needed = 0; @@ -4305,21 +4308,6 @@ process_serial_event (void) response_needed = 0; - if (!extended_protocol && have_ran && !target_running ()) - { - /* In non-stop, defer exiting until GDB had a chance to query - the whole vStopped list (until it gets an OK). */ - if (QUEUE_is_empty (notif_event_p, notif_stop.queue)) - { - /* 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); - } - } - if (exit_requested) return -1; |