2015-10-16 Luis Machado * remote.c (remote_wait_as): Reset rs->waiting_for_stop_reply when handling 'E', 'T', 'S', 'X' and 'W' packets. Set rs->waiting_for_stop_reply to 1 after handling 'F' packets. diff --git a/gdb/remote.c b/gdb/remote.c index f40f791..87b0b58 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -6635,9 +6635,6 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options) rs->stop_reason = TARGET_STOPPED_BY_NO_REASON; - /* We got something. */ - rs->waiting_for_stop_reply = 0; - /* Assume that the target has acknowledged Ctrl-C unless we receive an 'F' or 'O' packet. */ if (buf[0] != 'F' && buf[0] != 'O') @@ -6648,6 +6645,8 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options) case 'E': /* Error of some sort. */ /* We're out of sync with the target now. Did it continue or not? Not is more likely, so report a stop. */ + rs->waiting_for_stop_reply = 0; + warning (_("Remote failure reply: %s"), buf); status->kind = TARGET_WAITKIND_STOPPED; status->value.sig = GDB_SIGNAL_0; @@ -6655,10 +6654,19 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options) case 'F': /* File-I/O request. */ remote_fileio_request (buf, rs->ctrlc_pending_p); rs->ctrlc_pending_p = 0; + + /* GDB handled the File-I/O request, but the target is running + again. Keep waiting for events. */ + rs->waiting_for_stop_reply = 1; break; case 'T': case 'S': case 'X': case 'W': { - struct stop_reply *stop_reply + struct stop_reply *stop_reply; + + /* There is a stop reply to handle. */ + rs->waiting_for_stop_reply = 0; + + stop_reply = (struct stop_reply *) remote_notif_parse (¬if_client_stop, rs->buf);