diff options
-rw-r--r-- | gdb/gdbserver/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/gdbserver/remote-utils.c | 16 |
2 files changed, 21 insertions, 0 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 2e94aa8..4aa7350 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,8 @@ +2016-01-26 Yao Qi <yao.qi@linaro.org> + + * remote-utils.c (getpkt): If the buffer isn't empty, and the + first character is '\003', call *the_target->request_interrupt. + 2016-01-25 Yao Qi <yao.qi@linaro.org> * remote-utils.c (new_thread_notify): Remove. diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c index 292197a..ccc99f1 100644 --- a/gdb/gdbserver/remote-utils.c +++ b/gdb/gdbserver/remote-utils.c @@ -1041,6 +1041,22 @@ getpkt (char *buf) } } + /* The readchar above may have already read a '\003' out of the socket + and moved it to the local buffer. For example, when GDB sends + vCont;c immediately followed by interrupt (see + gdb.base/interrupt-noterm.exp). As soon as we see the vCont;c, we'll + resume the inferior and wait. Since we've already moved the '\003' + to the local buffer, SIGIO won't help. In that case, if we don't + check for interrupt after the vCont;c packet, the interrupt character + would stay in the buffer unattended until after the next (unrelated) + stop. */ + while (readchar_bufcnt > 0 && *readchar_bufp == '\003') + { + /* Consume the interrupt character in the buffer. */ + readchar (); + (*the_target->request_interrupt) (); + } + return bp - buf; } |