aboutsummaryrefslogtreecommitdiff
path: root/gdb/common/common-utils.c
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2016-01-26 13:50:22 +0000
committerYao Qi <yao.qi@linaro.org>2016-01-26 13:50:22 +0000
commit18879fef1741464e522624bcc529048400453e0d (patch)
treeafb3929d0e1e5f438b10332b8cb4d054874a602a /gdb/common/common-utils.c
parentffd9c127e6206b819a886227197ceddb4d6b00de (diff)
downloadbinutils-18879fef1741464e522624bcc529048400453e0d.zip
binutils-18879fef1741464e522624bcc529048400453e0d.tar.gz
binutils-18879fef1741464e522624bcc529048400453e0d.tar.bz2
[GDBserver] Check input interrupt after reading in a packet
GDBserver may read some packet together with '\003' in one go. We've already checked '\003' first when reading packet by my patch, Check input interrupt first when reading packet https://sourceware.org/ml/gdb-patches/2016-01/msg00057.html but if we don't check '\003' *after* each packet, the interrupt will be processed next time GDBserver reads from the buffer, so that the interrupt isn't processed in time. For example, GDB sends vCont;c and interrupt (see gdb.base/interrupt-noterm.exp), we'll resume the inferior and wait once packet vCont;c is seen. If we don't check the interrupt character after vCont;c packet, interrupt character will stay in the buffer unattended until GDBserver returns from the wait, which may take a while. Note that since we've read '\003' from file descriptor, SIGIO signal handler input_interrupt doesn't help either. This issue can be exposed by hacking the end of getpkt like @@ -1041,6 +1050,9 @@ getpkt (char *buf) } } + if (readchar_bufcnt > 0) + gdb_assert (*readchar_bufp != '\003'); + return bp - buf; } and this can trigger internal error, (gdb) PASS: gdb.base/interrupt-noterm.exp: interrupt Remote connection closed^M (gdb) FAIL: gdb.base/interrupt-noterm.exp: inferior received SIGINT Remote debugging from host 10.2.206.40^M /home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/remote-utils.c:1054: A problem internal to GDBserver has been detected.^M getpkt: Assertion `*readchar_bufp != '\003'' failed.^M This patch is to peek the buffer, if it is '\003', consume it and call *the_target->request_interrupt. gdb/gdbserver: 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.
Diffstat (limited to 'gdb/common/common-utils.c')
0 files changed, 0 insertions, 0 deletions