[PATCH 0/2 V2] Fix a fail in gdb.base/interrupt-noterm.exp

Yao Qi
2016-01-26T09:59:10Z

Hi,
In my test, I see the following fail intermittently,

interrupt
(gdb) PASS: gdb.base/interrupt-noterm.exp: interrupt
[Inferior 1 (process 13407) exited normally]

Child exited with status 0
FAIL: gdb.base/interrupt-noterm.exp: inferior received SIGINT (timeout)

because interrupt character isn't processed by GDBserver in time due to
two different problems:

1. GDBserver may receive vCont;c and '\003' together, and read them
into the buffer. GDBserver will wait for the inferior but there
won't be SIGIO because GDBserver has already read '\003' into the
buffer.

2. GDBserver may receive vCont;c only. GDBserver will resume the
inferior and wait for it. If '\003' arrives at the moment between
GDBserver received vCont;c and install SIGIO handler, GDBserver
can't receive SIGIO.

these two problems above cause GDB wait for the inferior and leave the
interrupt there, so the test is timeout.

Two patches in the series fix these two problems separately. Patch 1
fixes the problem 1 by checking the buffer *after* reading in each
packet. Patch 2 fixes the problem 2 by block/unblock SIGIO rather than
install/uninstall signal handler.

These two patches are tested on {x86_64,arm,aarch64}-linux. No
regression.

*** BLURB HERE ***

Yao Qi (2):
[GDBserver] Check input interrupt after reading in a packet
[GDBserver] Block and unblock SIGIO

gdb/gdbserver/remote-utils.c | 60 ++++++++++++++++++++++++++++----------------
1 file changed, 39 insertions(+), 21 deletions(-)

--
1.9.1