From fee9eda9eed2792c380d3dca8b5fd4c7ee1d0c32 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Sat, 15 Dec 2012 03:14:22 +0000 Subject: [PATCH] gdb/ 2012-12-15 Yao Qi * remote.c (getpkt_or_notif_sane): Add one more argument in its declaration. (getpkt_or_notif_sane_1): Add one more argument. (getpkt_sane): Update caller. (getpkt_or_notif_sane): Likewise. Update call togetpkt_or_notif_sane_1. (remote_wait_ns): Update caller. --- gdb/ChangeLog | 10 ++++++++++ gdb/remote.c | 29 +++++++++++++++++++---------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 28008da560..6c6c20519c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2012-12-15 Yao Qi + + * remote.c (getpkt_or_notif_sane): Add one more argument in + its declaration. + (getpkt_or_notif_sane_1): Add one more argument. + (getpkt_sane): Update caller. + (getpkt_or_notif_sane): Likewise. Update call + togetpkt_or_notif_sane_1. + (remote_wait_ns): Update caller. + 2012-12-15 Yao Qi Doug Evans diff --git a/gdb/remote.c b/gdb/remote.c index 929d4f53a7..0a839445a9 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -89,7 +89,7 @@ static void cleanup_sigint_signal_handler (void *dummy); static void initialize_sigint_signal_handler (void); static int getpkt_sane (char **buf, long *sizeof_buf, int forever); static int getpkt_or_notif_sane (char **buf, long *sizeof_buf, - int forever); + int forever, int *is_notif); static void handle_remote_sigint (int); static void handle_remote_sigint_twice (int); @@ -5634,15 +5634,16 @@ remote_wait_ns (ptid_t ptid, struct target_waitstatus *status, int options) struct remote_state *rs = get_remote_state (); struct stop_reply *stop_reply; int ret; + int is_notif = 0; /* If in non-stop mode, get out of getpkt even if a notification is received. */ ret = getpkt_or_notif_sane (&rs->buf, &rs->buf_size, - 0 /* forever */); + 0 /* forever */, &is_notif); while (1) { - if (ret != -1) + if (ret != -1 && !is_notif) switch (rs->buf[0]) { case 'E': /* Error of some sort. */ @@ -5679,7 +5680,7 @@ remote_wait_ns (ptid_t ptid, struct target_waitstatus *status, int options) /* Otherwise do a blocking wait. */ ret = getpkt_or_notif_sane (&rs->buf, &rs->buf_size, - 1 /* forever */); + 1 /* forever */, &is_notif); } } @@ -7410,11 +7411,13 @@ getpkt (char **buf, 0, this function is allowed to time out gracefully and return an indication of this to the caller. Otherwise return the number of bytes read. If EXPECTING_NOTIF, consider receiving a notification - enough reason to return to the caller. */ + enough reason to return to the caller. *IS_NOTIF is an output + boolean that indicates whether *BUF holds a notification or not + (a regular packet). */ static int getpkt_or_notif_sane_1 (char **buf, long *sizeof_buf, int forever, - int expecting_notif) + int expecting_notif, int *is_notif) { struct remote_state *rs = get_remote_state (); int c; @@ -7515,6 +7518,8 @@ getpkt_or_notif_sane_1 (char **buf, long *sizeof_buf, int forever, /* Skip the ack char if we're in no-ack mode. */ if (!rs->noack_mode) serial_write (remote_desc, "+", 1); + if (is_notif != NULL) + *is_notif = 0; return val; } @@ -7536,13 +7541,15 @@ getpkt_or_notif_sane_1 (char **buf, long *sizeof_buf, int forever, str); do_cleanups (old_chain); } + if (is_notif != NULL) + *is_notif = 1; handle_notification (*buf); /* Notifications require no acknowledgement. */ if (expecting_notif) - return -1; + return val; } } } @@ -7550,13 +7557,15 @@ getpkt_or_notif_sane_1 (char **buf, long *sizeof_buf, int forever, static int getpkt_sane (char **buf, long *sizeof_buf, int forever) { - return getpkt_or_notif_sane_1 (buf, sizeof_buf, forever, 0); + return getpkt_or_notif_sane_1 (buf, sizeof_buf, forever, 0, NULL); } static int -getpkt_or_notif_sane (char **buf, long *sizeof_buf, int forever) +getpkt_or_notif_sane (char **buf, long *sizeof_buf, int forever, + int *is_notif) { - return getpkt_or_notif_sane_1 (buf, sizeof_buf, forever, 1); + return getpkt_or_notif_sane_1 (buf, sizeof_buf, forever, 1, + is_notif); } -- 2.34.1